Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 17:03 Go to next message
John Gymer is currently offline John GymerFriend
Messages: 198
Registered: November 2012
Location: UK
Senior Member
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


---
Just because you can doesn't mean you should
Re: ClientScripting VerifyListener determine keystroke [message #997179 is a reply to message #997103] Fri, 04 January 2013 09:52 Go to previous messageGo to next message
John Gymer is currently offline John GymerFriend
Messages: 198
Registered: November 2012
Location: UK
Senior Member
...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.


---
Just because you can doesn't mean you should
Re: ClientScripting VerifyListener determine keystroke [message #997193 is a reply to message #997179] Fri, 04 January 2013 11:35 Go to previous messageGo to next message
John Gymer is currently offline John GymerFriend
Messages: 198
Registered: November 2012
Location: UK
Senior Member
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


---
Just because you can doesn't mean you should
Re: ClientScripting VerifyListener determine keystroke [message #997621 is a reply to message #997193] Fri, 04 January 2013 18:07 Go to previous message
Tim Buschtoens is currently offline Tim BuschtoensFriend
Messages: 387
Registered: July 2009
Senior Member
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:SashForm SWT.SMOOTH
Next Topic:RAP focus after shell setVisible
Goto Forum:
  


Current Time: Mon Dec 22 15:02:25 GMT 2014

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

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