Sunday, September 18, 2011

Howto listen for global key down events

How do I listen for key down events in the whole browser window,
independent of what component has the focus? The code below doesn't do
it. What's wrong? Actually I need to bind shortcut keys to components.
I know about the setAccessKey(char) method but this only handles the
alt key (Windows). I need to bind other combinations like combinations
including ctrl. Is this possible with GWT and how could it be done?

RootPanel.get().addHandler(new KeyDownHandler() {
public void onKeyDown(KeyDownEvent event) {
GWT.log("onKeyDown charCode=" + event.getNativeKeyCode());
}
}, KeyDownEvent.getType());


Any help appreciated, thanks!

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate