0

I need to catch the combination of Apple + C in GWT NativePreviewHandler

Here is the code that use to catch CTRL + C and it works:

nativeEventsHandlerRegistration = Event.addNativePreviewHandler(new Event.NativePreviewHandler() {

    @Override
    public void onPreviewNativeEvent(Event.NativePreviewEvent event) {

        NativeEvent nativeEvent = event.getNativeEvent();

        if (Event.getTypeInt(nativeEvent.getType()) == Event.ONKEYDOWN) {
            if (nativeEvent.getCtrlKey() && 'C' == nativeEvent.getKeyCode()) {      
                // do something
            }
        }

    }

});

I need the same thing but for MAC, any ideas?

2

1 Answer 1

1

There was already a discussion very similar to yours at stackoverflow go check it out:

How does one capture a Mac's command key via JavaScript?

1
  • Yep, saw it in the comment. Thanks, this is very helpful. Feb 18, 2013 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.