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,

-- 
Benoît Minisini

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to