First of all, instead of two events, there is now only one, KeyPressed. This event fires after a key has been pressed and the Details parameter now includes several more pieces of information:
- 4 Booleans that indicate the state of the different meta keys — AltKey, CtrlKey, MetaKey and ShiftKey.
- Character contains the character that the user typed, assuming the key that was pressed has a glyph associated with it.
- CharCode contains the ascii character code associated with the key.
- KeyCode contains the keyboard code associated with the key (note: this may be different than CharCode, but not always). 28 KeyCode Constants to help you figure out which non-character key has been pressed.
Note: Some browsers even include the key names in the Character property. For instance, if you pressed the down arrow key, Character might be set to "Down". Don't rely on this functionality, it's not consistent from browser to browser.
2 comments:
Hi All,
I really do not see how people can be confused by the events "KeyDown" and "KeyUp".
KeyDown fires when pressing a keyboard key, KeyUp fires when you release a key.
In a few instances I used KeyUp but mostly if not always I use KeyDown. Last time I used KeyUp I had to let the KeyDown event returning "True" otherwise the KeyUp event will do nothing.
I agree that the newly "KeyPressed" event is much more powerfull but personally for the desktop version, I prefer keeping KeyDown and KeyUp, but this is a personal preference. In case the KeyPressed event comes to the desktop version too, I will adapt my programing behaviour accordingly.
To the RealStudio team; very nice job done with the r2 release, thank you very much!
Have a very nice day.
Friendly greetings,
Bad_Wolf
This change only affects Web Edition. Desktop applications can still use the KeyUp and KeyDown events.
Post a Comment