Char events

Hi,

I'm very newbie to wxPython programming.
I read on the wxPython documents (that redirects to the wxWindows documentation) that:
http://www.wxpython.org/onlinedocs.php
"Notice that there are three different kinds of keyboard events in wxWindows: key down and up events and char events."

I've unfortunately not been able to find the way of using the char event.

This is important as I want to react not to a touch, but to a character. And those characters change depending of the keyboard layout (us, ch_fr, ...).

Thanks!

Guille

PS: Please include my e-mail in the answer as I am not in the mailing-lis.

Howdy Guille,

  Here is the post and response from a couple of days ago on this
matter.

-=> ########################################################## <=-

Artur Kapela wrote:

I would like to know if exists any possibility to get the 'real'
ASCII code for pressed key.

When I press key 'A' without any modifiers (like shift,alt ...) the
key event.GetCode() have return 65 and all modifiers are set off. I
know that should be ' 97 ' = 'a' and in this case isn't a problem.

It depends on the event you catch. EVT_KEY_DOWN and _UP will give you
raw key values while EVT_CHAR will give you "cooked" values with the
modifiers applied.

Is it possible to make something like event.Veto() in event
EVT_KEY_UP ? In event EVT_KEY_DOWN return from function without
event.Skip() works and stops the actions on the lowers levels , but
doesn't work in EVT_KEY_UP and the actions from the lowers levels are
executed.

Actually, they are probably handled in the native EVT_KEY_DOWN or
EVT_CHAR handlers...

The way wxWindows works is that if you handle EVT_KEY_DOWN and don't
call Skip then there will not be a EVT_CHAR generated for the key. Play
with the wxKeyEvent sample in the demo to get a better feel for things.

ยทยทยท

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

-=> ########################################################## <=-

Hope this helps.
-Jim

On Thu, 2003-09-11 at 09:30, Guillermo Fernandez wrote:

Hi,

I'm very newbie to wxPython programming.
I read on the wxPython documents (that redirects to the wxWindows
documentation) that:
http://www.wxpython.org/onlinedocs.php
"Notice that there are three different kinds of keyboard events in
wxWindows: key down and up events and char events."

I've unfortunately not been able to find the way of using the char event.

This is important as I want to react not to a touch, but to a character.
And those characters change depending of the keyboard layout (us, ch_fr,
...).

Thanks!

Guille

PS: Please include my e-mail in the answer as I am not in the mailing-lis.

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org