[Gambas-user] Gridview keypress question

Benoît Minisini gambas at ...1...
Fri Jun 29 16:31:15 CEST 2012


Le 09/06/2012 15:49, Benoît Minisini a écrit :
> Le 06/06/2012 13:29, Richard Terry a écrit :
>> Hi List,
>>
>> I've got a grid with several columns.
>>
>> If I use the arrow keys, then the grid focus moves up/down or to the
>> next/previous column.
>>
>> I want to over-ride this keypress behaviour, but can't manage it.
>>
>> If iI even try and detect a keypress n this event, nothing happens
>>
>> public Sub  Gridview1_Keypress()
>>
>>   print key.code
>>
>> end
>>
>> I''ve looked at the properties and can't seem to find one which will
>> allow me to over-ride this behaviour.
>> Probably something dumb I'm not seeing.
>>
>> Any help appreciated.
>>
>
> Yep. The problem comes from the Gambas GUi events internal design.
>
> The GridView control is a compound control written in Gambas.
> Consequently, it will see the keyboard events *before* the GridView user.
>
> For native controls, this is the contrary: you get its keyboard events
> before it handles them.
>
> I don't know if I will be able to have the same behaviour in the two
> cases. But I will try. :-)
>
> If you can't wait, there is a workaround: using an Observer on the
> GridView internal ScrollArea to catch the keyboard events before the
> GridView sees them. That way:
>
> MyObserver = New Observer(MyGridView.Children[0]) As "MyGridViewObserver"
>
> ...
>
> Public Sub MyGridViewObserver_KeyPress
> ...
> End
>
> Tell me if that workaround actually works.
>
> Regards,
>

This has been fixed in revision #4854.

-- 
Benoît Minisini






More information about the User mailing list