On 21 août, 21:02, Rakesh <
rake...@gmail.com> wrote:
> Thomas, I am not sure I understand what you are saying. I need the
> last char pressed by the user(on key down/up). How do you get that?
Use KeyPress.
KeyDown/KeyUp are for the gestures you're doing with your fingers on
your keyboard. For example:
a. you pressed the "A" key while the "Shift" key is depressed
b. you pressed the "A" without any modifier key depressed at the same
time
In both cases, you pressed the same key ("A"), so KeyDown/KeyUp will
give you the same NativeKeyCode. However, KeyPress events are about
characters (well, almost, Firefox and Opera are a bit different than
IE and Safari/Chrome), and you know that in the first case above
you'll have an "A" while the second case will generate an "a".
Need a more compelling difference? ever used the Alt+numeric key pad
combinations on Windows? try Alt+065 and Alt+097: three key
"gestures" (i.e. at least 3 key down + 3 key up events, I say at
least, because there might be keydown+keyup events for the Alt key)
but a single character being generated (keypress event); at least
that's the way it works in IE, and probably the future "standard
behavior" (those events are not spec'd anywhere yet), so expect
Firefox and others and update their behavior.