HOWTO: Create a Modeless CPropertySheet With Standard ButtonsLast reviewed: January 5, 1998Article ID: Q146916 |
The information in this article applies to:
SUMMARYBy default, a modeless CPropertySheet does not have any of the standard buttons that are in a modal CPropertySheet. These are the OK, Cancel, and Apply buttons. For a modeless CPropertySheet, MFC resizes the sheet and hides these buttons in CPropertySheet::OnInitDialog(). To prevent MFC from doing this, derive a class from CPropertySheet, override OnInitDialog(), and set "m_bModeless" to FALSE before CPropertySheet::OnInitDialog(). You should set "m_bModeless" back to TRUE after CPropertySheet::OnInitDialog().
MORE INFORMATIONNote that the standard buttons do not work the same way in a modeless CPropertySheet as they do in a modal one. Namely, the OK and Cancel buttons do not close the CPropertySheet when you click them. They will still send a WM_COMMAND message with IDOK or IDCANCEL to the sheet, and OnOK() or OnCancel() will still be called for the page. You can set up ON_COMMAND() handlers for IDOK and IDCANCEL in the CPropertySheet and call EndDialog() to close the sheet.
Sample Code
// CMySheet is derived from CPropertySheetBOOL CMySheet::OnInitDialog() { m_bModeless = FALSE; BOOL bResult = CPropertySheet::OnInitDialog(); m_bModeless = TRUE; return bResult;}
/* Compile options needed: default */ |
Additional reference words: kbinf 4.00 modeless CPropertySheet buttons
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |