ClientScripting VerifyListener determine keystroke [message #997103] |
Thu, 03 January 2013 12:03  |
Eclipse User |
|
|
|
I'm using ClientScripting to write a JavaScript VerifyListener for a complex numeric field, which works well for most cases, but I need to get the event.keyCode pressed to determine if the key stroke should be ignored or not (if unwanted, then I'll set event.doit = false).
This works perfectly if characters are typed anywhere in the field, but if I highlight one or more existing chars in the field, then type (thus replacing the existing chars), I don't get the new keyCode - it just comes back as 0.
Is this a bug in RAP/ClientScripting, or something else I can do to determine the keyCode pressed?
I was using a nightly RAP 2.0 M3 build, but have updated to M4 - still the same issue.
Thanks, John
|
|
|
|
|
Re: ClientScripting VerifyListener determine keystroke [message #997621 is a reply to message #997193] |
Fri, 04 January 2013 13:07  |
Eclipse User |
|
|
|
Hi.
> triggered, but event data (event.character and event.keyCode) is not
> populated... should I raise this as a bug, or am I expecting it to work
> when it is not intended to.
Just check against SWT. If SWT does provide a keyCode in this case, then
i'll regard it as a bug and you can report it to bugzilla. In any case,
there should be a value in event.text that you can check. It's a string,
bug you can convert a char of the string to a keycode using
"event.text.toLowerCase().charCodeAt( xxx )". However, this only works
with chars a-z.
Greetings,
Tim
--
Tim Buschtöns
Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/
Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
|
|
|
Powered by
FUDForum. Page generated in 0.03761 seconds