CPropertySheet::AddPage

Adds the supplied page with the rightmost tab in the property sheet.

void AddPage( 
   CPropertyPage *pPage  
);

Parameters

  • pPage
    Points to the page to be added to the property sheet. Cannot be NULL.

Remarks

Add pages to the property sheet in the left-to-right order you want them to appear.

AddPage adds the CPropertyPage object to the CPropertySheet object's list of pages but does not actually create the window for the page. The framework postpones creation of the window for the page until the user selects that page.

When you add a property page using AddPage, the CPropertySheet is the parent of the CPropertyPage. To gain access to the property sheet from the property page, call CWnd::GetParent.

It is not necessary to wait until creation of the property sheet window to call AddPage. Typically, you will call AddPage before calling DoModal or Create.

If you call AddPage after displaying the property page, the tab row will reflect the newly added page.

Example

// Add three pages to a CPropertySheet object, then show the  
// CPropertySheet object as a modal dialog.  CStylePage, CShapePage,   
// and CColorPage are CPropertyPage-derived classes created  
// by the Add Class wizard.  

CPropertySheet dlgPropertySheet(_T("Simple PropertySheet"));

CStylePage     stylePage;
CColorPage     colorPage;
CShapePage     shapePage;
dlgPropertySheet.AddPage(&stylePage);
dlgPropertySheet.AddPage(&colorPage);
dlgPropertySheet.AddPage(&shapePage);

dlgPropertySheet.DoModal();

Requirements

Header: afxdlgs.h

See Also

Reference

CPropertySheet Class

Hierarchy Chart

CPropertySheet::RemovePage