Condividi tramite


CPropertySheet::SetWizardButtons

Enables or disables the Back, Next, or Finish button in a wizard property sheet.

void SetWizardButtons( 
   DWORD dwFlags  
);

Parameters

  • dwFlags
    A set of flags that customize the function and appearance of the wizard buttons. This parameter can be a combination of the following values:

    • PSWIZB_BACK   Back button

    • PSWIZB_NEXT   Next button

    • PSWIZB_FINISH   Finish button

    • PSWIZB_DISABLEDFINISH   Disabled Finish button

Remarks

Call SetWizardButtons only after the dialog is open; you can't call SetWizardButtons before you call DoModal. Typically, you should call SetWizardButtons from CPropertyPage::OnSetActive.

If you want to change the text on the Finish button or hide the Next and Back buttons once the user has completed the wizard, call SetFinishText. Note that the same button is shared for Finish and Next. You can display a Finish or a Next button at one time, but not both.

Example

A CPropertySheet has three wizard property pages: CStylePage, CColorPage, and CShapePage. The code fragment below shows how to enable and disable the Back and Next buttons on the wizard property page.

// CStylePage is the first wizard property page.  Disable the Back  
// button but enable the Next button.
BOOL CStylePage::OnSetActive() 
{
   CPropertySheet* psheet = (CPropertySheet*) GetParent();   
   psheet->SetWizardButtons(PSWIZB_NEXT);

   return CPropertyPage::OnSetActive();
}
// CColorPage is the second wizard property page. Enable both the  
// Back button and the Next button.
BOOL CColorPage::OnSetActive() 
{
   CPropertySheet* psheet = (CPropertySheet*) GetParent();   
   psheet->SetWizardButtons(PSWIZB_BACK | PSWIZB_NEXT);

   return CPropertyPage::OnSetActive();
}
// CShapePage is the last wizard property page. Enable the Back  
// button and change the Next button to Finish. The "Finish" button 
// will have "Done" as its caption.
BOOL CShapePage::OnSetActive() 
{
   CPropertySheet* psheet = (CPropertySheet*) GetParent();   
   psheet->SetWizardButtons(PSWIZB_BACK | PSWIZB_FINISH);
   psheet->SetFinishText(_T("Done"));

   return CPropertyPage::OnSetActive();
}

Requirements

Header: afxdlgs.h

See Also

Reference

CPropertySheet Class

Hierarchy Chart