Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
About Button Controls (1.2)
◄Using Section► ◄Button Messages► ◄Styles► ◄Up► ◄Next► ◄Previous►
────────────────────────────────────────────────────────────────────────────
About Button Controls
This topic describes how to use button-control windows in your applications.
You should also be familiar with the following topics:
◄Messages and message queues►
◄MS OS/2 Resource Compiler►
A button control is a window that represents a button that a user can select
using the mouse or keyboard. Buttons can appear by themselves or in groups,
and can appear with or without label text. A user can select a button by
clicking it with the mouse or pressing the ENTER key when the button window
has the keyboard focus. Buttons typically change appearance when selected.
There are four main types of buttons: push buttons, radio buttons, check
boxes, and three-state check boxes. The appearance and behavior of button
controls is determined by the style of the button.
Radio buttons, check boxes, and three-state check boxes are used to control
attributes of an operation. Push buttons are used to initiate operations.
For example, a user might indicate paper size, print quality, and printer
type in a print-command dialog window containing an array of radio buttons
and check boxes. Once the user sets each option, a push button can be used
to tell an application that printing should begin (or be canceled). The
application queries the state of each radio button and check box to
determine the printing parameters.
Push buttons are rounded-corner rectangular windows containing text strings.
Push buttons become highlighted when they are selected by a user. They
return to an unhighlighted state when the user releases the mouse button or
the SPACEBAR. Push buttons are typically used to start or stop operations. A
push button posts a WM_COMMAND message to its owner window.
Radio buttons are windows with text displayed to the right of a small,
circular indicator. A radio button toggles between selected and unselected,
each time the user selects it. The button retains the state until the next
selection. Radio buttons usually appear in groups with only one button
selected at a time. Radio buttons are appropriate where an exclusive choice
is required from a group of related options. A radio button sends a
WM_CONTROL message to its owner window.
Check boxes are similar to radio buttons except that they are used by
themselves instead of in groups. They also toggle on or off application
features. A check box sends a WM_CONTROL message to its owner window.
Three-state check boxes are similar to check boxes except that they can be
displayed in halftone as well as selected or unselected. A three-state check
box sends a WM_CONTROL message to its owner window.
In addition to the four predefined button-control types, an application can
create buttons that appear defined by the owner window. Buttons using this
style send WM_CONTROL messages with BN_PAINT as the notification code to
their owner windows when they must be drawn or highlighted.
Button-control windows are always owned by other windows, typically by an
application client window or a dialog window. A button control posts
WM_COMMAND messages or sends WM_CONTROL notification messages to its owner
when a user selects the button. Owner windows can also send messages to
button controls to query or set states.
♦