Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

Visual C++ and MFC Fundamentals Chapter 15: Fundamental Controls


programmatically, once a control becomes dirty, call the
CPropertyPage::SetModified(). Its syntax is:

void SetModified(BOOL bChanged = TRUE);

This method is called by the control whose value you want to validate once the user has
modified it.

When the user clicks the OK button, the CPropertyPage::OnOK() event fires. By
design, the changes made on the controls are acknowledged. The controls receive the
status of “clean”. The property sheet closes.

When the user clicks the Cancel button, the CPropertyPage::OnCancel() event fires.
By design, the changes made on the controls are dismissed. The controls values are kept
as they were when the property sheet displayed as long as the user did not previously
click Apply since the property sheet was opened. The property sheet closes.

When the user clicks the Apply button, the CPropertyPage::OnApply() event fires. The
changes that were made on the controls are acknowledged. The property sheet stays
opened.

Once again, these behaviors are the default suggested by the standard but you can change
them as you wish, although you should remain with these suggestions because your users
may be more familiar with them.

Practical Learning: Manipulating Property Sheet Buttons



  1. Open the Geometry application. If you do not have it, locate the exercises that
    accompany this book and open the Geometry4 application

  2. Execute the application to review its interface:

  3. Close it and return to MSVC

  4. To delete the Apply and the Help buttons, call their DestroyWindow() method.
    Then move the OK and the Cancel buttons to the right where the other buttons were.
    To do this, implement the OnInitDialog event as follows:

Free download pdf