Window.onkeyup in GWT

How do I convert javascript code "window.onkeyup" (or onkeyup in body tag) to GWT?

Hello

+3
source share
2 answers

For a wide-range listener, you want to take a look at Event.addNativePreviewHandler . Attaching a keyboard listener should give you the effect you want. The modify fragment here should begin:

Event.addNativePreviewHandler(new NativePreviewHandler() {
  public void onPreviewNativeEvent(final NativePreviewEvent event) {
    final int eventType = event.getTypeInt();
    switch (eventType) {
      case Event.ONKEYUP:
        //magic here
        break;
      default:
        // not interested in other events
    }
  }
});
+6
source

I think you could do it with KeyboardListener.

It has a good discussion discussion (and some issues): http://groups.google.com/group/google-web-toolkit/browse_thread/thread/6072c87aa27a2d6e/524334b959683f77

0
source

Source: https://habr.com/ru/post/1726604/


All Articles