PRB: Returning FALSE from OnSetActive Doesn't Set Correct TabLast reviewed: July 10, 1997Article ID: Q145864 |
4.00
WINDOWS NT
kbprg kbprb kbcode
The information in this article applies to:
SYMPTOMSTo disallow activation of a CPropertyPage, you are supposed to be able to return FALSE from OnSetActive(). This causes the next page to be activated instead of the one the user clicked. This works fine as long as there is a next page and the next page returns TRUE from OnSetActive(). If the next page is not available, the tab you clicked will be activated but the page still points to the previous one. In other words, the tab that is activated doesn't match the page. Furthermore, the OnSetActive() function is called an additional ten times.
CAUSEReturning FALSE from OnSetActive() prompts MFC to return a -1 from PSN_SETACTIVE. The PropertySheet control doesn't handle this correctly when the next tab is not available.
RESOLUTIONIn OnSetActive(), post a message of PSM_SETCURSEL to activate a different page. Then return TRUE.
Sample Code
// CPage1 is derived from CPropertyPageBOOL CPage1::OnSetActive() { // always activate the first page instead GetParent()->PostMessage (PSM_SETCURSEL, 0); return CPropertyPage::OnSetActive();}
/* Compile options needed: default */ STATUSThis behavior is by design.
|
Additional reference words: 4.00 CPropertySheet CPropertyPage
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |