## The `shortcut' property

Two-element vector

Valid for: Menu

The `shortcut` property is used to make a menu item selectable via a shortcut key. The first element is the virtual key code of the key, or the character corresponding to the key. For the main letter and number keys, the virtual key code is the same as the ASCII code for the key, eg 65 for 'A' and 49 for '1'. You can specify either the virtual key code as an integer, or (for keys on the main keyboard) as a character scalar.

Under Windows and Linux, the second element determines the modifier keys which apply: 0 (Plain), 1 (Shift), 2 (Ctrl), 4 (Alt) and sums thereof. If you omit the second element, the default is 2 (Ctrl). Note: Some of these modifiers may not be useful in practice because the operating-system intervenes before APLX sees the keystroke; in Windows, for example, this happens with the Alt key.

Under MacOS, the second element is ignored since the Command key is always used for menu shortcuts.

Thus, these three lines all do the same thing, and specify Ctrl-C as the shortcut (or Cmd-C under MacOS):

          DEMO.EditMenu.Copy.shortcut„'C' 2
          DEMO.EditMenu.Copy.shortcut„67 2
          DEMO.EditMenu.Copy.shortcut„'C'

APLX automatically changes the displayed text in the menu to show the shortcut key.

When you read the `shortcut` property, APLX always returns the two-integer form.

Topic: APLX Help : System Classes : Properties : shortcut

[ Previous | Next | Contents | Index ]