INFO: Action of Static Text Controls with MnemonicsID: Q65883
|
The text of a static control may contain a mnemonic, which is a
character with which the user can access the control. A mnemonic is
indicated to the user by underlining the character in the text of the
control, and is created by preceding the desired character with an
ampersand (&).
Mnemonic characters are used in conjunction with the ALT key to allow
quick access to a control with the keyboard. When the user enters the
key combination of the ALT key and the mnemonic character, Windows
sets the input focus to the corresponding control and performs the
same action as when the mouse is clicked on that control. Push
buttons, option buttons, and check boxes all behave in this manner.
Because static text controls do not accept the focus, the behavior of
a mnemonic in a static text control is different. When the user enters
the mnemonic of a static text control, the focus is set to the next
enabled nonstatic control. A static text control with a mnemonic is
primarily used to label an edit control or list box. When the user
enters the mnemonic, the corresponding control gains the focus.
In this context, the order in which windows are created is important.
In a dialog box template, the control defined on the line following
the static text control is considered to be "next."
When the user enters the mnemonic of a static text control and the
next control is either another static text control or a disabled
control, Windows searches for a control that is nonstatic and enabled.
In some cases, it may be preferable to disable the mnemonic of a
static text control when the control it labels is also disabled. For
more information, please query in the Microsoft Knowledge Base on the
following word:
mnemonic
The dialog box described by the following dialog box template might be
displayed by an application when the user chooses Open from the File
menu:
IDD_FILEOPEN DIALOG LOADONCALL MOVEABLE DISCARDABLE 9, 22, 178, 112
CAPTION "File Open..."
STYLE WS_CAPTION | DS_MODALFRAME | WS_SYSMENU | WS_VISIBLE | WS_POPUP
BEGIN
CONTROL "File&name:", ID_NULL, "static",
SS_LEFT | WS_GROUP | WS_CHILD, 5, 5, 33, 8
CONTROL "", ID_NAMEEDIT, "edit",
ES_LEFT | ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP
| WS_CHILD | ES_OEMCONVERT, 40, 4, 90, 12
CONTROL "Directory:", ID_NULL, "static", SS_LEFT | WS_CHILD,
5, 20, 35, 8
CONTROL "", ID_PATH, "static", SS_LEFT | WS_CHILD, 40, 20, 91, 8
CONTROL "&Files:", ID_NULL, "static", SS_LEFT | WS_GROUP
| WS_CHILD, 5, 33, 21, 8
CONTROL "", ID_FILELIST, "listbox", LBS_NOTIFY | LBS_SORT
| LBS_STANDARD | LBS_HASSTRINGS | WS_BORDER | WS_VSCROLL
| WS_TABSTOP | WS_CHILD, 5, 43, 66, 65
CONTROL "&Directories:", ID_NULL, "static", SS_LEFT | WS_GROUP
| WS_CHILD, 75, 33, 49, 8
CONTROL "", ID_DIRLIST, "listbox", LBS_NOTIFY | LBS_SORT
| LBS_STANDARD | LBS_HASSTRINGS | WS_BORDER | WS_VSCROLL
| WS_TABSTOP | WS_CHILD, 75, 43, 65, 65
CONTROL "OK", IDOK, "button", BS_DEFPUSHBUTTON | WS_TABSTOP
| WS_CHILD, 139, 4, 35, 14
CONTROL "Cancel", IDCANCEL, "button", BS_PUSHBUTTON | WS_TABSTOP
| WS_CHILD, 139, 23, 35, 14
END
"File&name" labels the ID_NAMEEDIT edit control
"Directory" labels the ID_PATH static control display
"&Files" labels the ID_FILELIST list box
"&Directories" labels the ID_DIRLIST list box
mnemonic
Additional query words: radio shortcut
Keywords : kbCtrl kbNTOS kbStaticCtrl kbGrpUser kbWinOS
Version :
Platform :
Issue type : kbinfo
Last Reviewed: March 5, 1999