Enhance your knowledge about using dialogs and windows controls
Check Boxes
A check box consists of a square box and
application-defined text (label), an icon, or a bitmap, that indicates a choice
the user can make by selecting the button. Applications typically display check
boxes in a group box to permit the user to choose from a set of related, but
independent options. For example, an application might present a group of check
boxes from which the user can select error conditions that produce warning
beeps.
A check box can be one of four styles: standard, automatic, three-state, and automatic three-state, as defined by the constants BS_CHECKBOX, BS_AUTOCHECKBOX, BS_3STATE, and BS_AUTO3STATE, respectively. Each style can assume two check states: checked (a check mark inside the box) or cleared (no check mark). In addition, a three-state check box can assume an indeterminate state (a grayed box inside the check box). Repeatedly clicking a standard or automatic check box toggles it from checked to cleared and back again. Repeatedly clicking a three-state check box toggles it from
checked to cleared to indeterminate and back again.
When the user clicks a check box (of any style), the check box receives the keyboard focus. The system sends the check box's parent window a WM_COMMAND message containing the BN_CLICKED notification code. The parent window doesn't acknowledge this message if it comes from an automatic check box or automatic threestate check box, because the system automatically sets the check state for those styles. But the parent window must acknowledge the message if it comes from a check box or three-state check box because the parent window is responsible for setting the check state Using Dialogs and Windows Controls 11 for those styles. Regardless of the check box style, the system automatically repaints the check box once its state is changed.
Group Boxes
A group box is a rectangle that surrounds a set of
controls, such as check boxes or radio buttons, with application-defined text (label) in its upper left corner. The
sole purpose of a group box is to organize controls related by a common purpose (usually
indicated by the label). The group box has only one style, defined by the constant
BS_GROUPBOX. Because a group box cannot be selected, it has no check state, focus state, or
push state. An application cannot send messages to a group box.
Owner Drawn Buttons
Unlike radio buttons, an owner-drawn button is painted
by the application, not by the system, and has no predefined appearance or usage. Its purpose is to provide a
button whose appearance and behavior are defined by the application alone. There is
only one owner-drawn button style: BS_OWNERDRAW.
When the user selects an owner-drawn button, the system sends the button's parent window a WM_COMMAND message containing the BN_CLICKED notification code, just as it does for a button that is not owner-drawn. The application must respond appropriately.
When the user selects an owner-drawn button, the system sends the button's parent window a WM_COMMAND message containing the BN_CLICKED notification code, just as it does for a button that is not owner-drawn. The application must respond appropriately.
Push Buttons
A push button is a rectangle containing application-defined
text (label), an icon, or a bitmap that indicates what the button does when the user selects it. A push
button can be one of two styles: standard or default, as defined by the constants
BS_PUSHBUTTON and BS_DEFPUSHBUTTON. A standard push button is typically used to start an operation. It receives the keyboard focus when the user clicks it. A default
push button, on the other hand, is typically used to indicate the most common or default
choice. It is a button that the user can select by simply pressing ENTER when a dialog box has
the input focus. When the user clicks a push button (of either style), it receives the keyboard
focus. The system sends the button's parent window a WM_COMMAND message that
contains the BN_CLICKED notification code. In response, the dialog box typically
closes and carries out the operation indicated by the button. The default push button cannot be a check box, a radio button, or an ownerdraw
button at the same time. Using Dialogs and Windows Controls 12
Radio Buttons
A radio button consists of a round button and
application-defined text (a label), an icon, or a bitmap that indicates a choice the user can make by selecting the button.
An application typically uses radio buttons in a group box to permit the user to
choose from a set of related, but mutually exclusive options. For example, the application
might present a group of radio buttons from which the user can select a format preference for
text selected in the client area. The user could select a left-aligned, right-aligned,
or centered format by selecting the corresponding radio button. Typically, the user can
select only one option at a time from a set of radio buttons. A radio button can be one of two styles: standard or automatic, as defined by
the constants BS_RADIOBUTTON and BS_AUTORADIOBUTTON. Each style can assume two check states: checked (a dot in the button) or cleared (no dot in
the button). Repeatedly selecting a radio button (standard or automatic) toggles it from
checked to cleared and back again.
When the user selects either state, the radio button receives the keyboard
focus. The system sends the button's parent window a WM_COMMAND message containing
the BN_CLICKED notification code. The parent window doesn't acknowledge this
message if it comes from an automatic radio button because the system automatically
sets the check state for that style. But the parent window should acknowledge the
message if it comes from a radio button because the parent window is responsible for setting
the check state for that style. Regardless of the radio button style, the system
automatically repaints the button as its state changes. When the user selects an automatic radio button, the system automatically sets
the check state of all other radio buttons within the same group to clear. The same
behavior is available for standard radio buttons by using the WS_GROUP style, as discussed
in Dialog Boxes.
No comments:
Post a Comment
Thank you for your visit.