Wednesday, August 27, 2014

Handle escape key event on PopupPanel GWT 2.5.1

Hi everyone...i have a problem with handling the escape key event.
I have a popup panel and i want to intercept the keydown event when the escape button is pressed.
I override the "onPreviewNativeEvent" in order to manage the event (i want to hide the panel)
This is the snippet code

        @Override
protected void onPreviewNativeEvent(NativePreviewEvent event) {
int type = event.getTypeInt();
if (!event.isCanceled()) {
if (type == Event.ONKEYDOWN) {
int keyCode = event.getNativeEvent().getKeyCode();
// ESC clicked
if (keyCode == KeyCodes.KEY_ESCAPE) {
hide();
}
}
super.onPreviewNativeEvent(event);
}

But it seems that nothing works when i hit the button on the keyboard (only for the escape button. If i press another button the event is intercepted and everything works very well)
I can't understand where is the problem.

My application works on Internet Explorer 10 (and it must work only for Microsoft's browsers)

Thank you

Ale 


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment