Hi all,
I'm trying to add into my application some shortcut keys which will popped a small menu box if CTRL space is pressed.
In my EntryPoint I have a VLayout (called layout) that is drawn and is the root Element of my application.
So I have attached a keyDown handler to this...
Now this fires most of the time but I'm having a few issues...
1) On load of the application, key events do not fire until I click somewhere in the page. I'd guessed this is a focus issue but focus() does not seem to resolve the issue.
2) I have a Growl style alerts, which is basically a VLayout positioned in the top right corner. On closing the message, removeFromParent() and destroy() are called. Again this seems to lose focus and I have to click somewhere on page to get key presses working again.
3) There's places in the application where I add a tab to a tabset on the fly and then select that tab, again same thing here, events don't fire until I click on something.
To me it seems like a focus issue, anyone do something similar and have found away around this. I'd assumed its a focus issue, but attaching blur handlers do not seem to fire so suggest that's not the issue.
Any help/advice much appreciated.
Thanks,
Dale
SmartGWT Build Date : com.smartgwt.client.Version.getBuildDate() = Mon Dec 23 10:04:00 GMT 2013
SmartGWT Version : 4.0p
GWT Version : 2.4.0
Browser : IE11
I'm trying to add into my application some shortcut keys which will popped a small menu box if CTRL space is pressed.
In my EntryPoint I have a VLayout (called layout) that is drawn and is the root Element of my application.
So I have attached a keyDown handler to this...
Code:
public void setupShortcutKeys() { layout.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent keyPressEvent) { String pressedKey = keyPressEvent.getKeyName().toLowerCase(); if (EventHandler.ctrlKeyDown() && pressedKey.equals("space")) { if (HotLinkBar.getInstance().getContext() == HotLinkBar.LocationContext.EditCase) { MessageUtil.addInfoMessage("Edit Case - Quick Launch"); } else { MessageUtil.addInfoMessage("Other - Quick Launch"); } } } }); layout.focus(); }
1) On load of the application, key events do not fire until I click somewhere in the page. I'd guessed this is a focus issue but focus() does not seem to resolve the issue.
2) I have a Growl style alerts, which is basically a VLayout positioned in the top right corner. On closing the message, removeFromParent() and destroy() are called. Again this seems to lose focus and I have to click somewhere on page to get key presses working again.
3) There's places in the application where I add a tab to a tabset on the fly and then select that tab, again same thing here, events don't fire until I click on something.
To me it seems like a focus issue, anyone do something similar and have found away around this. I'd assumed its a focus issue, but attaching blur handlers do not seem to fire so suggest that's not the issue.
Any help/advice much appreciated.
Thanks,
Dale
SmartGWT Build Date : com.smartgwt.client.Version.getBuildDate() = Mon Dec 23 10:04:00 GMT 2013
SmartGWT Version : 4.0p
GWT Version : 2.4.0
Browser : IE11
Comment