[Gambas-user] How to populate a gridview from keyboard
Dominique SIMONART
simonart.dominique at ...11...
Tue Feb 17 19:03:52 CET 2009
Benoît Minisini a écrit :
>> Hi everyone,
>>
>> it seemed so simple that I feel a bit stupid with that question, but...
>> I want to fill a gridview with text coming from the keyboard, as in a
>> crossword.
>> I think I've to deal with the keypress event and the key.text data, but
>> how can I identify the cell to fill. I cannot even see any cursor on my
>> grid.
>> I want not to use the mouse cursor because my fingers are on the
>> keyboard all the time. I wish to define the next cell with the cursor
>> keys only.
>>
>> Could someone give me a short sample or point me on the right direction?
>>
>> Thanks in advance for your help
>> Dominique Simonart
>>
>>
>
> Just implement the cursor your self. Create a class named MyGridView that
> inherits GridView.
>
> In it, create an observer on yourself to catch the KeyPress event, and add two
> class variables (let's name them $X and $Y) to store the cursor coordinates.
>
> Catch the Data event too to define the background / foreground of the cell:
> Color.SelectededBackground and Color.SelectedForeground for the current cell
> (Row = $Y and Column = $X), nothing otherwise (the standard colors).
>
> Then each time you move the cursor, update the $X and $Y variables, and
> refresh the old current cell and the new one.
>
> If you don't want to use the Data event, you must use the MyGridView[X, Y]
> cell accessor.
>
> Regards,
>
>
Thanks to all,
Well Benoit, I think it's time for me to get inside all those
inheritage, observer, etc. Learning is really the master keyword in
programming! :)
May be it's what keep us interested in!
regards,
Dominique Simonart
More information about the User
mailing list