On the Mac, this problem is similar but less severe: Here, F-Key codes overlap with Control chars (e.g. both F9 and ctrl-P generate CHR(&h10), but at least those ctrl codes are hardly ever typed, whereas on Windows, any french user will curse at my application for not being able to tell french accented chars apart from F-Keys.
To clarify: In a TextField this of is little concern, but when filtering key presses in a Canvas or Window, I need to be able to tell F1 apart from so that I can react to them differently.
This has been discussed before and if I remember right there was no workaround
It is indeed a big issue not to be abe to distinguish between accented letters and function keys. For instance, the Quebec French keyboard generates directly É, which maybe confused for F2 by Xojo. Probably because in English there are no accents VB treats function keys much differently, with two byte codes containing a preceding zero.
But this increases your level of complexity a great deal since the same key code may be different “keys” when using different keyboard layouts (as noted under KeyCodes on http://documentation.xojo.com/index.php/Keyboard)
I just tested. The Keyboard.AsyncKeyDown does return a physical map of the keyboard. The list of keys mentionned on the documentation is valid only for the US keyboard. On a French keyboard where a and q are switched, a is &h0C and q is &h00.
But for function keys it works fine,as they are the same in all keyboards.
It should be fairly easy in KeyDown to use Keyboard.AsyncKeyDown first to see if the key is a function key and for instance add chr(0) as prefix to Key, so it disambiguates accented characters and function keys, pretty much the same way VB does.
[quote=81948:@Michel Bujardet]I just tested. The Keyboard.AsyncKeyDown does return a physical map of the keyboard. The list of keys mentionned on the documentation is valid only for the US keyboard. On a French keyboard where a and q are switched, a is &h0C and q is &h00.
[/quote]
This is precisely the problem with key code
What would be really useful is an “event record” of some kind - more like the web has for key events http://documentation.xojo.com/index.php/KeyEvent
Whether thats in conjunction with a “character” that the key press generates or not I’m not sure (although it might be simpler in total)