Sometimes it is desirable to provide users with a shortcut to select a menu choice. An accelerator key is a key which, when pressed simultaneously with certain control keys, has the same effect as clicking on the choice or button with the mouse. Pressing the accelerator key causes a pull-down choice to be selected even if the pull-down is not currently visible. The accelerator key for a choice or button is specified in the item definition. It consists of a key combined with any of the control keys Alt, Shift, and Ctrl (In ESL for Windows, you cannot use both Alt and Ctrl with the same accelerator.) When using an accelerator with a control key or keys, all the keys must be held down simultaneously. The key is either a single character string or an integer constant from the ACCEL.INC include file. Be sure to include this file if you want to use special keys such as the function keys.
For example, the button "F1 = Help" provides the function key F1 as an accelerator key to the user:
button HelpButton text "F1 = Help" accelerator is KEY_F1
Notice that the text of HelpButton tells the user what the accelerator key is. Be sure to identify the accelerator keys in the item's text. The user has no other way of knowing what the item's accelerator may be.
When using a single-character string to define an accelerator key, the character is case-independent. It is the shift keyword that determines whether the accelerator key will be uppercase; for example:
accelerator is "x" # accelerator is x accelerator is "X" # accelerator is x accelerator is shift "x" # accelerator is X accelerator is shift "X" # accelerator is X
For numbers or special characters, type the actual number or character; for example:
accelerator is "4" # accelerator is 4
accelerator is "$" # accelerator is $
Note: Be careful to choose a unique accelerator key for each choice or button in an action bar. Note that characters reserved for accelerator keys cannot be used for data entry. For example, the CUA keys for edit functions, such as Shift+Del for cut, will not perform their CUA function in an entry field when they are defined as accelerators in an action bar of the same region.