MenuItem.Shortcut

From Xojo Documentation

Property (As String )
aMenuItem.ShortCut = newStringValue
or
StringValue = aMenuItem.ShortCut

New in 2019r2

Supported for all project types and targets.

The keyboard shortcut for the MenuItem.

Notes

Use this property to set the shortcut in code. You can also specify a shortcut in the Inspector for the MenuItem.

You can use either a printable key or the following non-printable keys as shortcut keys: F1-F15, Tab, Enter, Space, Del (Delete), Return, Bksp (Backspace), Esc, Clear, PageUp, PageDown, Left, Right, Up, Down, Help, and Ins (Insert).

If the shortcut key is more than one character and it is being set via code, the modifier key is not implied and must be explicitly defined. For example, the following line sets the Tab key as the shortcut key and uses the Ctrl key as the modifier.

SpecialMyMenuItem.Shortcut = "Ctrl-Tab"

For macOS, use "Cmd" instead of "Ctrl." Or set the HasStandardModifierKey property to True in the IDE and pass the string literal for the desired keyboard shortcut.