Reputation: 151
In my GWT program I have a table that has a selected row. I'd like to move the row selection with the up- and down-keys on the keyboard. So I have to catch the key events somehow.
The GWT docs handle key events in input fields only. But I don't have an input field!
Is this possible at all? Maybe it is a DOM/Javascript restriction that GWT cannot work around...
Upvotes: 2
Views: 1688
Reputation: 151
It works by using Event.addNativePreviewHandler(NativePreviewHandler handler)
But there are some things to consider:
To work around the second issue you can get the name of the browser using this code:
private static native String getUserAgent() /*-{
return navigator.userAgent.toLowerCase();
}-*/;
Upvotes: 2