Workbench User Guide : 6. Creating and Using Basic Fields : Common Field Properties : How You Can Define an Alt Speed Key
 
Share this page                  
How You Can Define an Alt Speed Key
OpenROAD can set Alt speed keys for Button, Toggle, and Radio fields.
To position an underscore character, indicating which Alt speed key is desired, place an ampersand (&) prior to the character to be underscored when you create the label for the field, for example, "&Save" to underscore the S. You can create the label in the Frame Editor's Property Inspector for the field, or it may be created or changed dynamically by your 4GL code.
OpenROAD maintains the dynamic speed key table and associates the speed key with the field. This is done automatically for three types of fields: buttons, toggles, and radio fields.
Considerations for Alt Speed Keys
When defining Alt speed keys, consider the following issues:
Control Bias
Alt speed keys are activated only if the bias of the field with which they are associated is FB_CHANGEABLE or FB_LANDABLE. When the Alt key and the underscored character are pressed, it is as if the mouse button is clicked while the cursor is positioned over the field.
Printable Characters
The characters that can be used for Alt speed keys are all the printable characters in the current character set, except space (“ ”) and ampersand (“&”). Characters whose internal value is greater than 127 (0x7F) are supported so long as they can be typed without using the Alt key and the numeric keypad. Alt+function keys are not supported (except in the user-defined Speed Key Mapping).
Case Significance
The case of letters used as Alt speed keys is not significant. For example, both of the following button labels have Alt+K as the speed key: “O&K” and “O&k.” (Therefore, Alt+K and Alt+Shift+K would perform the same function.)
Including the “&” Character in a Label
Use double ampersands (“&&”) in the label of a field if you want to display a single ampersand as part of the label. For example, “This && That” displays as “This & That” with no underscore (and no Alt speed key).
Button Speed Keys
If the label for a button contains an ampersand, when the Alt key and the underscored character are pressed, the button is pressed as if the primary mouse button were clicked while the cursor is over the button. Focus behaviors, events, and so on, are the same as if the mouse were used.
Toggle Speed Keys
Both the ON-Label and the OFF-Label can have Alt speed keys. They can be the same (for example, “&On” and “&Off”) or different (such as “O&n” and “O&ff”).
If they are different, only the one currently displayed is active. In the same manner as for buttons, using the Alt speed key is identical to clicking with the primary mouse button.
Radio Button Speed Keys
Any, all, or none of the buttons in a radio field can have Alt speed keys associated with them. Pressing the Alt speed key associated with a radio button selects that button. In the same manner as for button fields, using the Alt speed key is identical to clicking with the primary mouse button.
Order of Precedence for Speed Keys
Speed keys using the Alt key can be defined in the following ways:
Alt speed keys
Defined by placing an ampersand in the label of a Button, Toggle, or Radio button
User speed keys
Defined by creating a user-defined speed key file
Menu speed keys
Defined by creating a menu item with an ampersand in its label
Only one action is performed when a speed key using the Alt key is pressed, even if that speed key is defined in more than one of the previous ways at the same time. The order of precedence for speed keys is Alt, User, then Menu.
Limitations
The following limitations apply to speed keys:
Only one Alt speed key is supported per label
If more than one ampersand is included in the text for a label, only the character following the last ampersand will be the Alt speed key. Prior ones are ignored. This does not apply to double ampersands used as an escape to display a single ampersand.
Duplicate Alt speed keys are not supported
Using the ampersand to define more than one field to have the same Alt speed key is not supported. If you use the ampersand in this way, only one of the fields will actually be associated with that Alt speed key. The field chosen cannot be predicted and is subject to random fluctuations while the frame is running. (Toggle fields may use the same Alt speed key for their ON-Label and OFF-Label, since only one of these will be active at a given time.) Take care when assigning Alt speed keys dynamically.