CPropertyPage::Construct

Call this member function to construct a CPropertyPage object.

void Construct( 
   UINT nIDTemplate, 
   UINT nIDCaption = 0  
); 
void Construct( 
   LPCTSTR lpszTemplateName, 
   UINT nIDCaption = 0  
); 
void Construct( 
   UINT nIDTemplate, 
   UINT nIDCaption, 
   UINT nIDHeaderTitle, 
   UINT nIDHeaderSubTitle = 0  
); 
void Construct( 
   LPCTSTR lpszTemplateName, 
   UINT nIDCaption, 
   UINT nIDHeaderTitle, 
   UINT nIDHeaderSubTitle = 0  
);

Parameters

  • nIDTemplate
    ID of the template used for this page.

  • nIDCaption
    ID of the name to be placed in the tab for this page. If 0, the name will be taken from the dialog template for this page.

  • lpszTemplateName
    Contains a null-terminated string that is the name of a template resource.

  • nIDHeaderTitle
    ID of the name to be placed in the title location of the property page header. By default, 0.

  • nIDHeaderSubTitle
    ID of the name to be placed in the subtitle location of the property page header. By default, 0.

Remarks

The object is displayed after all of the following conditions are met:

  • The page has been added to a property sheet using CPropertySheet::AddPage.

  • The property sheet's DoModal or Create function has been called.

  • The user has selected (tabbed to) this page.

Call Construct if one of the other class constructors has not been called. The Construct member function is flexible because you can leave the parameter statement blank and then specify multiple parameters and construction at any point in your code.

You must use Construct when you work with arrays, and you must call Construct for each member of the array so that the data members are assigned proper values.

Example

// Declare a CPropertySheet object.
CPropertySheet sheet(_T("Simple PropertySheet"));

// Create three CPropertyPage objects whose template IDs are specified 
// in rgID array, and add each page to the CPropertySheet object.  
const int c_cPages = 3;
CPropertyPage   pages[c_cPages];
UINT rgID[c_cPages] = {IDD_STYLE, IDD_COLOR, IDD_SHAPE};
for (int i = 0; i < c_cPages; i++)    
{
   pages[i].Construct(rgID[i]);
   sheet.AddPage(&pages[i]);
}

// Display a modal CPropertySheet dialog.
sheet.DoModal();

Requirements

Header: afxdlgs.h

See Also

Reference

CPropertyPage Class

Hierarchy Chart

CPropertyPage::CPropertyPage

CPropertySheet::DoModal

CPropertySheet::AddPage