Accelerator Property

Applies To

Description

This property specifies a keystroke that, when pressed by the user, will generate a Select event on an object. It applies to all objects whether or not they possess a "natural" Select  event. You can therefore associate a keystroke with an arbitrary action on any object you desire.

The Accelerator property is a 2-element integer vector. The first element is a key number which is the number by which Windows knows the key. The second element is the shift state which is the sum of 1 (Shift key), 2 (Control key) and 4 (Alt key).

For example, to attach the keystroke Ctrl+A to an object, you would set its Accelerator to (65 2). To attach the keystroke Shift+Ctrl+F1 (key number 112), you would set its Accelerator to (112 3). Key numbers may be obtained by displaying the messages generated by the KeyPress  event.

Note that a keystroke used as an Accelerator will not generate a KeyPress  event.