Skip to main content



      Home
Home » Eclipse Projects » Remote Application Platform (RAP) » ClientScripting VerifyListener determine keystroke(Do not get typed keycode in ClientScripting Verify Listener)
ClientScripting VerifyListener determine keystroke [message #997103] Thu, 03 January 2013 12:03 Go to next message
Eclipse UserFriend
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 #997179 is a reply to message #997103] Fri, 04 January 2013 04:52 Go to previous messageGo to next message
Eclipse UserFriend
...at least I thought ClientScripting was working with M4, but isn't now... I probably got confused between my normal VerifyListener and the ClientScripting code... I'll pull the nightly M4 and latest ClientScripting together to see if the problem still exists... but it looks like none of the ClientScriping is being invoked at all. No messages in browser console as far as I can see either.
Re: ClientScripting VerifyListener determine keystroke [message #997193 is a reply to message #997179] Fri, 04 January 2013 06:35 Go to previous messageGo to next message
Eclipse UserFriend
Yup, just to confirm that ClientScripting is working again using nightly builds of RAP 2.0 M4 and ClientScripting from last night.
However, the original issue from this post still stands i.e. if you REPLACE characters in a field rather than just inserting or appending new chars, the Verify event in ClientScripting's JavaScript is 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.
Thanks, John
Re: ClientScripting VerifyListener determine keystroke [message #997621 is a reply to message #997193] Fri, 04 January 2013 13:07 Go to previous message
Eclipse UserFriend
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/
Previous Topic:Java applet in browser widget covers modal dialogs
Next Topic:Rap exaple does not work
Goto Forum:
  


Current Time: Tue Jul 22 18:05:59 EDT 2025

Powered by FUDForum. Page generated in 0.03761 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top