[Contents] [Index] [Help] [Retrace] [Browse <] [Browse >]

A command key sequence is an event generated when the user holds down one
of the Amiga keys (the ones with the fancy A) and presses one of the
normal alphanumeric keys at the same time.  There are two different
command or Amiga keys, commonly known as the left Amiga key and the right
Amiga key.

Menu command key sequences are combinations of the right Amiga key with
any alphanumeric character, and may be used by any program.  These
sequences must be accessed through the menu system.  Command key sequences
using the left Amiga key cannot be associated with menu items.

Menu command key sequences, like the menus themselves, are only available
for a window while that window is active.  Each window may control these
keys by setting keyboard shortcuts in the menu item structures which make
up the window's menu strip.

If the user presses a command key sequence that is associated with one of
the menu items, Intuition will send the program an event that is identical
to the event generated by selecting that menu item with the mouse.  Many
users would rather keep their hands on the keyboard than use the mouse to
make a menu selection when accessing often repeated selections.  Menu
command key sequences allow the program to provide shortcuts to the user
who prefers keyboard control.

A command key sequence is associated with a menu item by setting the
COMMSEQ flag in the Flags variable of the MenuItem structure and by
placing the ASCII character (upper or lower case) that is to be associated
with the sequence into the Command variable of the MenuItem structure.

Command keys are not case sensitive and they do not repeat.  Command keys
are processed through the keymap so that they will continue to work even
if the key value is remapped to another position.  International key
values are supported as long as they are accessible without using the Alt
key (right-Amiga-Alt maps to the right mouse button on the mouse).

     Figure 6-4: Menu Items with Command Key Shortcuts 

When items have alternate key sequences, the menu boxes show a special
Amiga key glyph rendered roughly one character span plus a few pixels from
the right edge of the menu select box.  The command key used with the
Amiga key is displayed immediately to the right of the Amiga key image, at
the rightmost edge of the menu select box (see figure).

Space must be provided at the right edge of the select box for the Amiga
key imagery and for the actual command character.  Leave COMMWIDTH pixels
on high resolution screens, and LOWCOMMWIDTH pixels on low resolution
screens.  The character's width may be calculated with the graphics
library TextLength() call.  In general, each column of items should leave
enough room for the widest command character plus the width of the Amiga
key imagery.