开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜