Subject Re: Data Input in Grid via numeric buttons
Author Tony Masefield
--- In IBObjects@yahoogroups.com, "ronald_greven" <rs@s...> wrote:
>
> In my application I have 10 buttons with numeric values. (0-9)
> Well, I also use a IB_Grid in this application.
>
> And I would like to realize the following :
>
> I click on a button an the value of the button should be assumed
in
> the selected cell. This is no problem.
> But if I click another button (for example : first button : 1
second
> button : 2 = value 12) so the focus changes to the button and if
the
> new value is written to the cell is 2 not 12.
>
> I hope, I explained it understandable.
>
> Does somebody know, how I could handle this?
>
> Many thanks
>
> Ronni

Hi Ronni,

If I understand you correctly you want to use a simulated nuneric
keyboard to input data into a cell?

In brief outline OTTOMH:

You will have to capture the individual KeyPress data from your
simulated numeric keypad as characters and not as a numerics,
concatonate the characters together into a string, then cast the
string back to numeric before inputting into the required cell.
You can use the "OnKeyPress" event for this and also check for the
enter key being pressed at which time you enter the data into the
cell, set the string to null (for the next input) and then set focus
on the next cell.

If the same number of numerals are being entered each time (like a 4
digit PIN number) then rather than checking for the enter key being
hit you could use a "For" loop to count up to the required number of
digits and then set focus on the next cell when you hit the total
required input digits.

If you have entry cells that do not require the simulated numeric
keyboard then you will have to dissable the numeric keyboard for
those cells (or rather enable the numeric keyboard for the cells you
want it to be used for). You could otherwise set the "Visible"
property for the simulated keyboard to true when it is required.

These comments are based on the "standard" DBGrid so assume they
will work in the IBO version.

HTH
Tony