Hey community,

I am working on a project where I want to introduce a keyboard shortcut for 
a particular action.

private void shortcutKeyHandler() {
    Event.addNativePreviewHandler(new Event.NativePreviewHandler() {
        @Override
        public void onPreviewNativeEvent(Event.NativePreviewEvent event) {
          NativeEvent nativeEvent = event.getNativeEvent();
          if (event.getTypeInt() == Event.ONKEYDOWN && 
nativeEvent.getAltKey() && nativeEvent.getKeyCode() == 191 && 
!db.isShowing()) {
            nativeEvent.preventDefault();
            execute();
          } 
        } 
      });
    }

In the code, I implemented a shortcut (Alt + /) to display a dialog box. 
While it works well with English keyboard layouts, the problem arises with 
other layouts where the Slash key (keycode 191) generates a different 
keycode.

Is there some workaround with the help of JSNI?

I would greatly appreciate any help in determining how to check the 
character code and verify if the Alt key is pressed.

Thanks in advance 

-- 
You received this message because you are subscribed to the Google Groups "GWT 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/google-web-toolkit/93604fce-6900-4745-bd20-62dc71e8f5e8n%40googlegroups.com.

Reply via email to