MENU KEY
instruction: assign a key to a menu item
Menu Key(single item parameters) To c$
Menu Key(single item parameter) To scancode, bitmap
Any key can be assigned to an item in a previously defined menu, provided that the item specified is at the bottom level of the menu. In other words, keyboard shortcuts cannot be used to select sub-menus because each command must correspond to a single option in the menu.
In its simplest form, define the single item parameters as usual, by giving their hierarchy numbers in brackets after MENU KEY. Then assign the item TO a string containing a single character. Any additional characters in this string will be ignored.
Because each key on the Amiga keyboard is assigned its own scancode, this code can be made use of for those keys that have no Ascii equivalents, the so-called control keys. Here is a simple routine to print out scancodes:
E> Do Repeat A$=inkey$ Until A$<>"" Z=Scancode Print Z Loop
The following scancodes can also be used with the MENU KEY command, instead of a character string:
Scancode Keys 80 to 89 Function keys [Fl] to [F10] 95 [Help] 69 [Esc]
An optional bitmap can also be added, to check for control key combinations such as [Ctrl] + [A]. Here are the alternatives:
Bit Key Tested Notes 0 left [Shift]) only one [Shift] key can be tested at a time 1 right [Shift] only one [Shift] key can be tested at a time 2 [Caps Lock] either ON or OFF 3 [Ctrl] 4 left [Alt] 5 right [Alt] this is the [Commodore] key on some keyboards 6 left [Amiga] 7 right [Amiga]