Shortcut to MenuItem randomly fails

In my MainMenuBar I have a menuitem Month with submenu month(January->December) indexed 0-11, each with a shortcut key 1-10 (+alternate menu modifier 1-2)

That way I can choose February with command-2 and so on…

Randomly this shortcut fails and I just here a beep. This continues on all keys 1-10. To make shortcuts work again I can press command-T (menuhandler just return true) or just a click on the menubar.

I have put debug line on the menuhandler which never gets fired when problem occurs. Does anyone have an idea to point me in the right direction?

I have tried on different OS X versions with same result
OS X Ventura and Xojo 2022R2

cmd-2 is received by an other controller. Do you use with tab panel in your window? On safari cmd-2 open the second tab.

have you other keydown handler method in your project ?

try to test with a small project : just your menu bar and system.debug

OS (and MacOS in this case) usually talkes cmd-1, 2, 3, 4, etc.

Use instead Cmd-Shift-<#>.

Same apply for F, R, etc. the list is endless…

Johan says it randomly fails, not every time. Your explanation would imply it should never work.

1 Like

Under macOS cmd-0, cmd-1 etc are free to use by applications.
If you like to know which shortcut keys are used by macOS, have a look at the keyboard settings (you can enable/disable systemwide shortcut keys there).

Thank you all for your replies
I don’t use this shortcuts/keydown on other controller, but the application reacts just like there are no menuhandler (just a beep).

Could it be that another controller is active and receives the menuhandler event, even if it’s not visible? It’s a bit strange because clicking on controls in the correct controller does not help. I have to click on menubar or another shortcut to make it work again. Just tried with command-V. I don’t have a menuhandler for this command, but it made command-2 work again! Command-Y did not help.

He also talk aboutr Cmd-V (Paste…)…

Yes, It’s strange that CMD-V Paste solves the problem even if it has no MenuHandler, but CMD-Y does not.

These are the screenshot shortcut defaults.