PRB: Modal Property Sheet Not Modal in Propdlg SampleLast reviewed: July 18, 1997Article ID: Q132951 |
1.52
WINDOWS
kbprg kbprb
The information in this article applies to:
SYMPTOMSA modal property sheet brougt up by running the PROPDLG sample allows you to switch to other windows (such as the view window) in the application, and choose menu items. This is not proper behavior for a modal property sheet. This problem occurs only with the Propdlg sample included with Visual C++ version 1.52. It does not occur in the Propdlg sample included with the 32-bit versions of Visual C++.
CAUSEThis problem results from passing "this" to the constructor for the CModalShapePropSheet making the view the parent of the property sheet:
void CShapesView::OnPropertySheetWithPreview() ... m_pModalShapePropSheet = new CModalShapePropSheet(this);This problem does not occur in the 32-bit version implementation of modal property sheets, because the CPropertySheet::DoModal() member function, disables the application's top level window:
// find parent HWND HWND hWndTopLevel; CWnd* pParentWnd = CWnd::FromHandle( AfxGetSafeOwner(m_pParentWnd, &hWndTopLevel)); if (hWndTopLevel != NULL) ::EnableWindow(hWndTopLevel, FALSE);However, in the 16-bit code, this functionality is missing:
// find parent HWND CWnd* pParentWnd = CWnd::FromHandle(AfxGetSafeOwner(m_pParentWnd)); RESOLUTIONPass NULL or a pointer to the application's main frame window as the parent to the property sheet to correct this behavior. This works because AfxGetSafeOwner() returns the top level window in either of these cases as the main frame window. Later, in the CPropertySheet::DoModal() function, a call to pParentWnd->EnableWindow(FALSE) causes the top level window to be disabled.
MORE INFORMATION
Steps to Reproduce Behavior
|
Additional reference words: 2.52
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |