PRB: Child CPropertySheet Hangs If Focus Is SwitchedLast reviewed: June 26, 1997Article ID: Q149501 |
The information in this article applies to:
SYMPTOMSIf a modeless CPropertySheet is a child of a CDialog or another CPropertySheet, the program will hang in the following situations:
CAUSEBy default, CPropertyPages have a WS_EX_CONTROLPARENT style. However, CPropertySheets do not have this style. This style allows a user to press the TAB key to move from a control inside the page to one in the sheet. When the focus is switched from the CPropertyPage, code that handles default command buttons loops through all the controls in the pages and the sheet. Cycling through controls is done using GetNextDlgTabItem(). The loop cycles through controls in the page in the child CPropertySheet and finds its way to controls in the parent page or parent dialog. At this point, GetNextDlgTabItem() is not able to find controls inside the child CPropertySheet because it doesn't have a WS_EX_CONTROLPARENT style. The loop never ends because it never finds the original control that had the focus.
RESOLUTIONOverride OnInitDialog() for the child CPropertySheet, and add the WS_EX_CONTROLPARENT style.
STATUSThis is problem with the implementation of the Property Sheet common control, and not MFC's CPropertySheet wrapper. The problem has been fixed in Windows NT 4.0.
MORE INFORMATION
Sample Code
// CMySheet is derived from CPropertySheet BOOL CMySheet::OnInitDialog() { ModifyStyleEx (0, WS_EX_CONTROLPARENT); return CPropertySheet::OnInitDialog(); } /* Compile options needed: default */ |
Additional query words: WS_CHILD Property Sheet lock freeze Property page
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |