How to catch key-pressed event with UIBinder
In GWT + UiBinder you can catch clicks like this:
@UiHandler("cancelButton")
void onCancelButtonClicked(ClickEvent e) {
// cancel code goes here;
}
Is there an equivalent for key pressed? For example if the user presses the ESC key then we cancel a开发者_JS百科n action.
Thank you so much.
This should work:
@UiHandler("myWidget")
void onKeyDown(KeyDownEvent e) {
// key down code goes here
}
The widget will have to implement HasKeyDownHandlers
.
精彩评论