Chapter 16: Text-Based Controls Visual C++ and MFC Fundamentals
To programmatically change the caption of the control, call the
CWnd::SetWindowText() method.
All other properties of a group box are those of a STATIC control.
15.4 Command Buttons.......................................................................................
15.4.1..Overview...............................................................................................
A Button is a Windows control used to initiate an action. From the user’s standpoint, a
button is useful when clicked, in which case the user positions the mouse on it and
presses one of the mouse’s buttons.
There are various kinds of buttons. The most common and regularly used is a rectangular
object that the user can easily recognize. In some programming environments, this classic
type is called a Command Button. There are other controls that can serve as click controls
and initiate the same behavior as if a button were clicked.
From the programmer’s standpoint, a button needs a host, such as a dialog box. To add a
button to a dialog box, click it on the Toolbox and click in the desired location on the
dialog box.
By default, when you visually create a dialog box, Microsoft Visual C++ adds two
buttons: OK and Cancel. If you do not need these buttons, click one and press Delete
15.4.2..Command Buttons Properties and Methods....................................
The most popular button used in Windows applications is a rectangular control that
displays a word or a short sentence that directs the user to access, dismiss, or initiate an
action or a suite of actions. In Visual C++ applications, this control is implemented using
the Button control from the Controls toolbox window. Therefore, to add a button to
a container, click the Button control and click on the host, which can be a dialog
box or a form. Once you have added the control to your application, you can set its
properties using the Properties window.
Like every Window control, a button is recognized by its IDentifier. Because a button is a
control, by convention, its identifier's name starts with IDC (the C stands for Control).
From the user’s point of view, the only things important about a button are the message it
displays and the action it performs. The word or sentence that displays on top of a button
Note
The MFC library
categorizes
various controls
as buttons. This
includes the
classic command
button, the radio
button, and the
check box.