mnemonic([key])
Class: Menu. Method inherited from MenuItem.
Description:
Gets or sets the mnemonic (keyboard shortcut key) for menu item type of components: Menu, MenuItem, CheckBoxMenuItem, RadioButtonMenuItem. Its not same as setting keyboardShortcut(...).
A mnemonic allows users to activate the menu item using the keyboard (typically Alt + key).
NOTE: Not all systems and UIs show underline under mnemonic character. Some systems only show it after Alt key was pressed.
Parameters:
| Name | Type | Description |
|---|---|---|
|
|
string |
A single character representing the mnemonic key (case-insensitive). If omitted, acts as a getter. |
Returns:
If called without arguments, returns the current mnemonic key. If a key is provided, sets the mnemonic and returns this MenuItem instance.
Type: string | MenuItem
Examples:
menuItem.text("Quit").mnemonic("q"); // Makes letter Q to be used as the keyboard shortcut key
