Chapter 16: Text-Based Controls Visual C++ and MFC Fundamentals
?? If the user clicks Cancel, the change(s) made on the property page’s control(s)
would be discarded, not taken into consideration, and the property sheet would
be closed
?? When the property sheet comes up, the Apply button on the property page is
disabled. If the user changes something on the controls of the property page(s),
the Apply button would become enabled:
Once the Apply button is enabled, the user can use it. If the user clicks the
Apply button, 1) any change(s) made on the control(s) is(are) sent to the object
that called the property sheet, 2) the Apply button becomes disabled again, 3)
the dialog box remains opened.
This description is conform to the standards or suggestions of the Microsoft
Windows operating system. In reality, you are completely free to do what you
want with the buttons on the property sheet:
?? You can hide them
?? you can display them
?? you can completely delete (destroy) any unneeded button
?? you can add as many buttons as you judge necessary and as the bottom
area can afford
?? you can change the captions of the buttons
Some of these issues we already know how to do. We already know that each control of
an MFC application has an identifier. The buttons automatically added to a property sheet
are identified as IDOK for the OK button, IDCANCEL for the Cancel button,
ID_APPLY_NOW for the Apply button, and IDHELP for the Help button. Therefore,
to manipulate any of these buttons, you can call the CWnd::GetDlgItem() method to get
a handle to the desired button and do what you want with it. Suppose you had created the
Geometry application we dealt with in Chapter 13. Here is an example code you can use
to change the caption of a button, hide another button, or simply destroy another:
BOOL CGeomeSheet::OnInitDialog()