The information in this article applies to:
SYMPTOMSInitializing controls in a CPropertyPage in CPropertyPage:: OnInitDialog() by way of their associated member variables doesn't work. For example, to initialize an edit control that is associated with a CString member variable called "m_strData", you could do the following:
The edit control will not be set to "Hello" at run time. This used to work
in MFC 4.0 and 4.1.
CAUSE
Data is transferred from member variables to their associated controls when
UpdateData() is called (UpdateData() calls DoDataExchange() which calls DDX
functions). UpdateData() is called by OnInitDialog() and OnSetActive().
This caused UpdateData() to be called twice when a CPropertyPage is first
created. This was a problem in MFC 4.0 and MFC 4.1. It was fixed in MFC
4.2. OnSetActive() now checks a flag (m_bFirstSetActive) to see if this is
the first time it is being called. If it is the first time, then
UpdateData() is not called. RESOLUTIONYou can initialize member variables in the CPropertyPage's constructor or right before the call to CPropertyPage::OnInitDialog().
or
STATUSThis behavior is by design. Additional query words: 4.20 4.10 4.00
Keywords : kbMFC KbUIDesign kbVC |
Last Reviewed: July 29, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |