[Laszlo-dev] Keyboard mystery [Was: Re: For Review: Change 20090602-bargull-GPN Summary: DHTML: add "updateControlKeys" to LzKeyboardKernel]
andre.bargull at udo.edu
Tue Jun 2 12:33:01 PDT 2009
The only reliable information  for keydown/keyup events is the
virtual key code . For example, Firefox doesn't even support
'charCode' for keydown/keyup (only keypress), or in ActionScript3
'charCode' "Contains the character code value of the key pressed or
released. The character code values are English keyboard values." .
But as it is only the English keyboard value, it's not a real help for
us if we want to work with Unicode characters .
So we can only forward the keycode value from the kernel to LzKeys and
let users cope with that information.
And there is also a bug in the mapping from keycodes to charcodes in the
keyboard kernel for swf8 and dhtml (LPP-8241).
 let's say "almost" reliable
 e.g. shift+3 produces charCode=35 which is the character code for
'#', but on a German keyboard shift+3 is the '§' character.
On 6/2/2009 7:14 PM, P T Withington wrote:
> Something that is really a mystery to me is the internal protocol
> between the keyboard kernel and LzKeys. The kernel sends both a map of
> the abstract keys that have changed state, _and_ the last physical key
> code. LzKeys maps the abstract keys to Flash physical keycodes, but if
> it finds any abstract key that does not have a flash mapping, it uses
> the platform physical code (which may or may not intersect with a Flash
> physical code). I'm guessing this was an attempt to make LZX code more
> portable, but it's a pretty messy transformation (and looks to me like
> it could cause some bugs because of the way the exception code works).
> In the long run, it would seem like a better approach would be to create
> a new set of LzKeys interfaces that dealt in abstract keys (as in
> Unicode characters + strings to represent keys that do not correspond to
> characters, like F1, Page-up, etc.) plus shift key states, which would
> be uniform across platforms; and eventually deprecate the interfaces
> that deal with Flash keycodes.
More information about the Laszlo-dev