3.8. Assign Accelerator Keys

About this task

  • Accelerator key definition.
  • Create an accelerator key.
  • Guidelines for accelerator keys.

Accelerator key definition

Accelerator keys:

  • Enable users to access dialog box controls by pressing Alt + <specified letter>.
  • Are essentially a single letter from a control's label.

Users can employ accelerator keys to:

  • Choose a push button or an option button.
  • Toggle a check box on or off and move the insertion point into one of the following.
  • Text box
  • Group box
  • Currently selected item in one of the following.
  • List box.
  • Combo box.
  • Drop list box..

Create an accelerator key

Procedure

  1. Open the Information dialog box for the control that will have an assigned an accelerator key.
  2. Select the Text$ field.
  3. Type an ampersand (&) before the letter designated as the accelerator key.
  4. Click the OK button or press Enter on the keyboard.

Results

The designated letter is now underlined on the control's label; users will be able to access the control by pressing Alt +<underlined letter>.

Guidelines for accelerator keys

  • Accelerator keys can be assigned directly to the following controls that have their own label
  • Check boxes
  • Group boxes
  • Option buttons
  • Push buttons
  • The OK and Cancel buttons cannot have accelerator keys

Note: OK and Cancel labels cannot be edited.

  • A de facto accelerator key can be created for certain controls that do not have their own labels by assigning an accelerator key to an associated text control.
  • Combo boxes
  • Drop list boxes
  • List boxes
  • Text boxes
  • Accelerator key assignments must be unique within a particular dialog box. If you attempt to assign the same accelerator key to more than one control, a message displays reporting that the letter has already been assigned.
Note: In order for such a de facto accelerator key to work properly, the text control or group box label to which you assign the accelerator key must be associated with the control(s) to which you want to provide user access that is, in the dialog box template, the description of the text control or group box must immediately precede the description of the control(s) that you want associated with it. The simplest way to establish such an association is to create the text control or group box first, followed immediately by the associated control(s)