NSMenuFX icon indicating copy to clipboard operation
NSMenuFX copied to clipboard

KeyCode.SHORTCUT not working when adding keyboard accelerators

Open jkaving opened this issue 2 years ago • 0 comments

Using the KeyCode.SHORTCUT constant doesn't work for adding keyboard shortcuts with the Command key. The same issue was reported in codecentric/NSMenuFX#42 .

The shortcut key is a virtual key that is used to represent different keys on different platforms (in order to create platform-independent keyboard shortcuts). Here's a part of the Javadoc for KeyCombination:

/**
 * ...
 * The {@code shortcut} modifier is used to represent the modifier key which is
 * used commonly in keyboard shortcuts on the host platform. This is for
 * example {@code control} on Windows and {@code meta} (command key) on Mac.
 * By using {@code shortcut} key modifier developers can create platform
 * independent shortcuts. So the "Shortcut+C" key combination is handled
 * internally as "Ctrl+C" on Windows and "Meta+C" on Mac.
 * ...
 */

jkaving avatar Nov 18 '22 13:11 jkaving