From: Miguel A. Figueroa-V. <mi...@ie...> - 2006-06-10 22:33:26
|
[Peter Vanroose wrote:] >> ? | vgui_SHIFT | / | ? >> >> However, qt and gtk (not sure what mfc does) both get the ASCII >> character of the event and do: >> ... >> ? | vgui_SHIFT | ? | ? > > The former is indeed too much "keyboard layout" oriented, i.e., does > not work for people with a non-QWERTY keyboard. > And there are lots of people in that case! > (Mine, for example, is AZERTY, with SHIFT(',') = '/' and lots of other > SHIFT differences). > I would be very surprised if MFC would do it differently from gtk or > Qt, since Microsoft has always taken care of different keyboard > layouts. Note that where I wrote qt/gtk/mfc, I should have referred to those vgui toolkit implementations (i.e., qt/gtk/mfc support doing the right thing, but the toolkit might not be up-to-date, or might have coded some different interpretation of the docs). The current design was intended to constrain the events specified by users to a valid state. A user writing something like: vgui_event_condition(vgui_key('A'), vgui_MODIFIER_NULL); is clearly trying to get the [a/A] keypress, but the requirement of having to press the SHIFT to get the 'A' makes this impossible to get to. >> if (k > 0 && k < 32 && k != vgui_ESC && k != vgui_TAB ...) > > This *could* be a keyboard layout related choice as well. > Of course all (Western) keyboards have Enter, Esc and Tab, and nothing > else, but I vaguely remember having read that Don Knuth is using a > keyboard with lots of other keys (maybe including a formfeed key?) > Also, most keyboards have two Enter keys which could be mapped to > different things (like ASCII 10 versus ASCII 13). > > So couldn't this issue be solved somehow in a way that does *not* make > any assumptions on the keyboard being used? (But I have no actual > suggestion as to how to do that since my knowledge of vgui is rather > limited...) If not, I'm happy with the "if k != vgui_TAB" etc, but in > that case this choice should be clearly documented, I believe. Well, the correct thing to do is to use the ascii_char instead of the modifier+key combination... Currently, you could just as well do: vgui_event_condition('A') // this will compare the ascii value or // this will compare to the key_press and the modifier vgui_event_condition('a', vgui_SHIFT) // this only works because we are anticipating // the error and changing 'A' to 'a' vgui_event_condition('A', vgui_SHIFT) So, ideally we would like users to do vgui_event_condition('?') instead of the other two... vgui_event_condition('/', vgui_SHIFT vgui_event_condition('?', vgui_SHIFT) --Miguel |