[wx-discuss] keys/chars events handling
Mart Raudsepp
leio at dustbite.net
Tue Mar 7 00:09:19 PST 2006
On Thu, 2005-11-10 at 13:02 +0100, Vadim Zeitlin wrote:
> On Tue, 08 Nov 2005 09:04:11 +0100 jmf <jfauth at bluewin.ch> wrote:
>
> j> IsKey(char key, int modifiers)
> j>
> j> is a good idea.
>
> We may still add it later but for now I've just added
> wxKeyEvent::GetModifiers() which returns a bit mask of wxMOD_XXX (where XXX
> = Shift, Ctrl, Alt, Meta). This allows to write correct code easily, e.g.
>
> if ( event.GetModifiers() == wxMOD_CONTROL )
>
> instead of (wrong)
>
> if ( event.ControlDown() )
>
> or (correct but long)
I'm going through my unfiltered INBOX messages, and found that I didn't
follow this thread earlier.
Hate to bring such an old thread alive, but:
How precisely is such a method going to help not write wrong code?
Especially if the bit mask contains Shift, Ctrl, Alt and Meta, but not
AltGr.
Let me list the problems that I see with this:
a) AltGr != ctrl+alt on some platform, most notably any X11 one (with
estonian layout, at least). In fact, currently I don't see any of these
modifiers being on in the text sample when I hold down AltGr.
b) Meta == Numlock often in X11. If the app developer does
event.GetModifiers() == wxMOD_CONTROL then it won't match if the numlock
is on, and it pretty often is. If I have numlock on and press a key,
then the meta modifier is shown as active in the text sample tests.
GTK+ resolved this with a default modifier mask - See
http://developer.gnome.org/doc/API/2.0/gtk/checklist-modifiers.html
With Regards,
Mart Raudsepp
---------------------------------------------------------------------
To unsubscribe, e-mail: wx-discuss-unsubscribe at lists.wxwidgets.org
For additional commands, e-mail: wx-discuss-help at lists.wxwidgets.org
More information about the wx-discuss
mailing list