how to catch arrow keys ?

hello,

I'm trying to catch arrow keys to manipulate cursors in a plot.

Now I tried both , wx.EVT_KEY_DOWN and wx.EVT_CHAR,
and they seem to work equally bad ...
... if I press a normal character, the event is catched
... if I press an arrow key, I don't catch anything
and even weirder ...
... after pressing an arrow key, I can't catch any normal characters anymore ?

Who can enlighten me ,
thanks,
Stef Mientki

Stef,

<div class="moz-text-flowed" style="font-family: -moz-fixed">

I bind to wx.EVT_KEY_DOWN on Windows XP and the arrow key's events work for me. For example, in my handler I just put the following to catch the left arrow key:

hi Mike,
I'm too on winXP, I bind to the graphical control,
are you binding to the application ?

cheers,
Stef

</div>

I'm binding to a wx.Grid widget in my application. Still, I would think that would work. Maybe Robin or Andrea can give us some advice?

Mike

Mike Driscoll wrote:

Stef,

I bind to wx.EVT_KEY_DOWN on Windows XP and the arrow key's events work for me. For example, in my handler I just put the following to catch the left arrow key:

hi Mike,
I'm too on winXP, I bind to the graphical control,
are you binding to the application ?

cheers,
Stef

I'm binding to a wx.Grid widget in my application. Still, I would think that would work. Maybe Robin or Andrea can give us some advice?

How are you doing the event binding? If you're not binding to the widget that has the focus then your handler will not be called.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Stef Mientki wrote:

As I want to use the arrow keys for finetuning a crosshair,
(simply because it's the most human interpretation),
how can I catch the arrow keys,
and do something useful with it,
other than toggling the focus.

Try adding the style wx.WANTS_CHARS.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Robin Dunn wrote:

Stef Mientki wrote:

As I want to use the arrow keys for finetuning a crosshair,
(simply because it's the most human interpretation),
how can I catch the arrow keys,
and do something useful with it,
other than toggling the focus.

Try adding the style wx.WANTS_CHARS.

thanks Robin,
that works great !!

Isn't the name a little bit strange:
without "wx.WANT_CHARS" you can catch every (character) key except arrow-keys and tab,
and with "wx.WANT_CHARS" you can catch also arrow-keys and tab ?

cheers,
Stef