virtual LRESULT OnWizardNext();
Return Value
0 to automatically advance to the next page; –1 to prevent the page from changing. To jump to a page other than the next one, return the identifier of the dialog to be displayed.
Remarks
This member function is called by the framework when the user clicks on the Next button in a wizard.
Override this member function to specify some action the user must take when the Next button is pressed.
For more information on how to make a wizard-type property sheet, see CPropertySheet::SetWizardMode.
Example
// The Next button is selected from the propertysheet. Show the
// second page of the propertysheet ONLY if a non-zero value is
// entered to the Number edit control of the CStylePage. When the
// second page is not shown, it is removed from the propertysheet.
// m_PropPageArray is a member variable in CStylePage of type
// CArray<CPropertyPage*, CPropertyPage*>. It contains pointers to
// all pages of the propertysheet, and is initialized in the
// OnInitDialog(). CStylePage is a CPropertyPage-derived class.
LRESULT CStylePage::OnWizardNext()
{
CPropertySheet* sheet = (CPropertySheet*) GetParent();
int count = sheet->GetPageCount();
int arr_size = m_PropPageArray.GetSize();
int num = GetDlgItemInt(IDC_NUMOBJECTS);
if (num == 0)
{
// Remove the second page ONLY if it is found in the propertysheet.
if (count == arr_size)
sheet->RemovePage(m_PropPageArray[1]);
}
else
{
// Add the second page back to the propertysheet ONLY if it
// is NOT found from the propertysheet.
if (count < arr_size)
{
// Since CPropertySheet() always adds new pages to the end of
// its propertypage list, we have to remove all pages starting
// at index 1 (original location for the second page). Then,
// add them back one at a time.
for (int i = 1; i < count; i++)
sheet->RemovePage(i);
for (i = 1; i < arr_size; i++)
sheet->AddPage(m_PropPageArray[i]);
}
}
return CPropertyPage::OnWizardNext();
}
BOOL CStylePage::OnInitDialog()
{
CPropertyPage::OnInitDialog();
// Store pointers to all the pages in m_PropPageArray.
CPropertySheet* sheet = (CPropertySheet*) GetParent();
int count = sheet->GetPageCount();
for (int i = 0; i < count; i++)
m_PropPageArray.Add(sheet->GetPage(i));
// Return TRUE unless you set the focus to a control.
// EXCEPTION: OCX Property Pages should return FALSE.
return TRUE;
}
CPropertyPage Overview | Class Members | Hierarchy Chart
See Also CPropertySheet::SetWizardMode