You can assign a new shortcut in code without the Command modifier, e.g.
FileOpen.Shortcut = “Shift-O”
However, such shortcut produces a valid string when typed, so it will be intercepted by any focused TextEdit object in the active window. The same happens with Option as the modifier.
As a whole, I would strongly advice you not to mess with system-defined shortcuts as macOS users are pretty unforgiving towards applications which do not obey the macOS look-and-feel.
pretty sure you can’t do this on a mac. at least with xojo.
you can of course use a keydown event to make the action you want , but in the menus the cmd key is mandatory.
Thanks Stéphane, “-O” works fine to avoid the Command.
Unfortunately not for take over the “h” used for the Finder. The finder uses command-H to hide application, I use only “h” for an action, but -Oh dont work here.
Thanks Jean-Yves, I already use keydown to intercept the choosed action, but I wished to have also a menu with all shortcuts, as a facility to the user.
For your information, the Finder doesn’t use command-H differently than any other application (which it is as well). The OS does.
And, as Stéphane mentioned, having a different behaviour with your app like using Command-H is probably not a good thing.
Being a user who use the keyboard most of the time, I usually trash an application which messes with usual shortcuts, even if it could be a good one.
The app I’m developing is a game, with many actions and shortcuts.
In the game you may use the keyboard keys for actions, not the usual OS command-keys, so, using “h” or “s” doesn’t interferes with the standard Hide App or Save.
My problem was that I did know how to create menu options without the added command.
Yes, and I’m glad you got an answer for your question.
Still, it’s important to think as the final user and wonder whether they’ll feel comfortable with your tweaks.
Sure, but as it’s a game where you don’t write text, or feed text fields, just acts. Then I believe, the actions like “go to next unit” -> N, go to previous -> P, or hide units -> H, etc., are comfortable for the user.