PDA

View Full Version : onKeyPress handler causes all Windows disappear on clicking ESC



yashodhar.g
16 Aug 2010, 6:08 AM
If i have multiple GXT windows opened in Chrome or Firefox, hitting ESC key is closing all the windows. When i try to debug the isOrHasChild works fine for IE but not for FF / Chrome.

The Window class of GXT uses BaseEventPreview and creates handler for key press event as shown below:

protected void onKeyPress(WindowEvent we) {
int keyCode = we.getKeyCode();
if (closable && onEsc && keyCode == KeyCodes.KEY_ESCAPE
&& getElement().isOrHasChild((com.google.gwt.dom.client.Element) we.getEvent().getEventTarget().cast())) {
hide();
}
}


Is there a work around or a fix for this?

I am using GXT 1.6 and GXT 2.1.1

Thank you
Sreekanth

sven
16 Aug 2010, 6:10 AM
http://www.sencha.com/examples/explorer.html#dialog

open the two examples. I can close them one after another with ESC in firefox and also chrome.

Have you tried to update GWT to 1.7.1 for example (instead of using 1.6).

yashodhar.g
16 Aug 2010, 11:09 PM
I did not try with GWT 1.7. I will do try and see what happens and then reply back. Thank you for your response.

Regards
Sreekanth

yashodhar.g
17 Aug 2010, 12:12 AM
The problem remains even while using GWT 2.0. The issue is not with dialog and it is with GXT windows.

To reproduce the problem, goto http://www.sencha.com/examples/desktop.html

Open multiple GXT windows in chrome / FF. Hit ESC and nothing works and no window will close.

Thank you
Sreekanth

sven
17 Aug 2010, 2:08 AM
Works fine against 2.2 beta 1: http://www.sencha.com/examples-dev/desktop.html

Have you tried to use that version?

Also note that a dialog is a window.

yashodhar.g
17 Aug 2010, 3:11 AM
I see the behavior is good in IE as well as FF by looking at http://www.sencha.com/examples-dev/desktop.html

Chrome is also good with an exception that i have to set focus on active window manually after launching the window so that ESC works.

Yes, i noticed the fact that Dialog inherits from Window. How-ever i could not understand why behavior is different for dialog vs windows (when multiple are open) while hitting ESC in GXT 2.0

Thanks again for all your replies!

Regards
Sreekanth