2.1 accelerator and Mnemonic

Accelerators and Mnemonics enable practiced users to work quickly and efficiently with an application. Accelerators and mnemonics are used primarily in the menu system. The DM supports accelerators and mnemonics for all selectable objects. Their usability, however, depends above all on the used window system.

If accelerators and mnemonics are used, the marginal conditions multilinguality and use of different keyboards have to be considered, because alphanumeric characters are language-dependent and function and special keys are keyboard-dependent. There is no reliable subset of function keys and special keys on keyboards.

Remarks

2.1.1 accelerator

An accelerator is defined as a key or a key combination linked to a dialog object. By pressing an accelerator key or

  • alphanumeric keys, which are language-dependent, but may also be keyboard-dependent,
  • alphanumeric keys which are not language-dependent, but may be keyboard-dependent, the dialog object linked to this accelerator is selected and the action linked to the dialog object is executed.

To provide an object with an accelerator, you first have to define a resource accelerator. This resource accelerator consists of the keyword accelerator, an identifier, an opening brace, of one or several key specifications, and the closing brace. The key specification is preceded by a number and a colon. This number stands for the keyboard type. The relevant key specification is selected by setting the keyboard type.

By using the key combination the dialog object which is linked to this accelerator will be selected and the action specific to the object will be executed.

Definition

{ export | reexport } accelerator <Identifier> <acceleratorSpec> | <variantDef>
acceleratorSpec ::=
  <key definition> { , "<display name>" | <text resource> } ;
key definition ::=
  { <modifier> + } { <modifier> + } { <modifier> + }
  & | '<alphanumeric key>' | <function key> | <special key>
modifier ::= alt | cntrl | shift
function key ::= F1 | F2 | … | F98 | F99
variantDef ::=
{
           0 : <acceleratorSpec>
  [ <number> : <acceleratorSpec> ]
}

In some dialog objects, the key combination for an accelerator is displayed on the right of the text (depends on the window system).

The optional string or text resource after the actual definition of the button can be used to specify the text that is to appear as accelerator text in the object. This text will then be displayed accordingly in menu items.

In contrast to mnemonics, accelerators do not have a visual feedback. The attribute .real_visible has to be true, but the object does not have to be in the visible area. Only dialog objects with accelerators in the active window can be selected. The accelerators of all dialog objects in a window have to be clearly defined. If an accelerator is used more than once in a window, it cannot be predicted which accelerator will actually be activated.

Accelerators are language-dependent as well as keyboard-dependent, and are thus treated as normal resources (e.g. colors and fonts), which are hardware-dependent as well.

The DM differentiates three types of keys:

The keyboard type can be set if the Dialog Manager is called with the option

-IDMkeyboard [<Number>]

0 is the default keyboard type, which is used if no keyboard type was set or if the accelerator does not have a variant for the chosen keyboard type. This is why it is useful to use the 0 variant in the accelerator definition in general

An accelerator key combination consists of a key which can be preceded by an arbitrary number of modifier keys with the + symbol. Modifier keys are cntrl, alt, and shift. Alphanumeric keys are specified by 'single quote - character - single quote'.

Example

accelerator A

{

  0:  alt+'a';

}

In the current Motif version of the Dialog Manager, accelerators are labeled only in the object menuitem.

Example

accelerator A_QUIT

{

  0:  cntrl+F2;

  1:  cntrl+F5;

}

If an accelerator shall be language-dependent and shall change automatically if the language changes, a & has to be specified in place of the key. This specification has the effect that the mnemonic character for the dialog object is also used for the accelerator (provided that this object has a mnemonic).

Example

accelerator A_QUIT

{

  0:  cntrl+&;

  1:  cntrl+alt+&;

}

text  "E&xit"

{

  1:  "&Beenden";

  2:  "&Finito";

}

child menuitem M1

{

  .text         E&xit;

  .accelerator  A_QUIT;

}

This resource, identified as A_QUIT, can now be assigned to a dialog object. The dialog object is automatically labeled with the accelerator text (provided that the used window system allows the labeling for this object).

Remark

The key combination Ctrl + Alt + Del should never be used.

Modifier keys cannot be used as accelerators. Individual alphanumeric characters and cursor keys should not be used alone as accelerators, i.e., they should be used in combination with other keys.in Kombination mit anderen Tasten verwendet werden.

Keys or key combinations already having a predefined function in the corresponding window system should not be used.

Please also refer to the section “Note on problematic situations”.

Alphanumeric characters cannot be specified in connection with the shift modifier.

Function keys and special keys can be specified by the following identifiers:

BackSpace

/* back space, back char */

Begin

/* BOL */

Break

 

Cancel

/* Cancel, stop, abort, exit */

Clear

 

Delete

/* Delete, rubout */

Down

/* Move down, down arrow */

End

/* EOL */

Escape

 

Execute

/* Execute, run, do */

Find

/* Find, search */

Home

 

Insert

/* Insert, insert here */

Left

/* Move left, left arrow */

Linefeed

/* Linefeed, LF */

Next

/* Next, Page Down */

Pause

/* Pause, hold, scroll lock */

Print

 

Prior

/* Prior, previous, PageUp */

Redo

/* redo, again */

Return

/* Return, enter */

Right

/* Move right, right arrow */

Select

/* Select, mark */

Tab

 

Undo

/* Undo previous*/

Up

/* Move up, up arrow */

Function Keys:

F1 - F99

Modifier Keys:

Note concerning the Caps Lock Key

The Caps Lock key will be ignored by the function keys. If you want to use the combination Shift + F3, you must use the Shift key, it is not possible to use the Caps Lock key to trigger the accelerator.

Note on problematic situations

System accelerators should not be used, otherwise multiple triggering or interception of the event (on key or select) may occur; moreover, this may vary depending on the accelerator and window system.

Examples

In addition, the use of an accelerator

should be carefully considered. Depending on the window system used, the current dialog state, and the way or order in which the windows are made visible, the accelerator concerned could be triggered twice on different objects or on the same object.

2.1.1.1 Menus and accelerators under Microsoft Windows

Under Microsoft Windows, accelerators are used to select menu functions without opening a menu. As a result, the accelerators are no longer triggered when a menu is open. Instead, you can now use the respective mnemonics to select a menu item.

2.1.2 Mnemonic

Mnemonics do not belong to the resources as such; they have to be defined as attributes. Because of their close relationship to accelerators, their definition is described here.

A mnemonic is exactly one alphanumeric character which is marked in the text of a dialog object. The corresponding object can be activated with this character.

Example

In a menubox:

File

In a pushbutton:

Exit

The corresponding menu opens by hitting a special key, the so-called mnemonic key, together with the character marked in the menu bar. A menuitem can now be activated by hitting a key which corresponds to the character marked in the menu. No special key needs to be hit now.

Usually mnemonics have a visual feedback. This means that the activated dialog object appears on screen in a selected state, and the action linked to the object is executed by pressing the assigned key. Only the dialog objects located in the currently active window can be activated.

The mnemonic character is always taken from the language-dependent text and is specified together with this text. The letter following the & symbol is the mnemonic character. It appears highlighted on the screen. The & symbol will not be displayed. If & shall appear in the dialog object on the screen, two & symbols in succession have to be specified.

The language is set if the DM is called with the option

-IDMlanguage [<Number>]

Example

text  "E&xit"

{

  1:  "&Beenden";

  2:  "&Finito";

}

child menuitem M1

{

  .text  E&xit;

}

The availability of mnemonics depends on the used window system and will only work if the object can be selected by the user.

Microsoft Windows

Mnemonics are supported for the following objects (if .real_sensitive = true):

Mnemonics can be activated by pressing

As an alternative, you can also use the function key F10.

Mnemonic characters must be used without Alt, if a menu is highlighted.

Motif

Mnemonics are supported for the following objects:

Mnemonics can be activated by pressing

If a menu is open, mnemonic characters must be used without Alt.

You can only choose the mnemonics which are visible on screen.

Qt

Mnemonics are supported for the following objects: