Creating Embedded Child Property Sheets | CodeGuru

Creating Embedded Child Property Sheets

Environment: Windows NT4 SP6, Visual C++ 6 SP3 Having a property sheet inside a property page causes some problems: Child CPropertySheet hangs if focus is switched (Q149501). Parent property sheet terminates even if a child page has a Data Exchange failure. OK, Cancel, and QuerySibling messages are not transferred to child sheets. Child sheet has […]

Written By
CodeGuru Staff
CodeGuru Staff
Feb 16, 2000
1 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

Environment: Windows NT4 SP6, Visual C++ 6 SP3

Having a property sheet inside a property page causes some problems:

  • Child CPropertySheet hangs if focus is switched (Q149501).
  • Parent property sheet terminates even if a child page has a Data Exchange failure.
  • OK, Cancel, and QuerySibling messages are not transferred to child sheets.
  • Child sheet has to be created and sized manually.
  • The class CChildPropertyPage derived from CPropertyPage
    solves the above problems. To use a child property sheet you simply use
    this class instead of CPropertyPage to implement your resource.
    You add the child pages in the same way as you would add pages to a normal
    property sheet. See the demo project.

    The example project implements the above example. It shows how to use the
    child property sheet on a full page and limited by a group box. The example
    is simply created with the following statements:

    CPropertySheet dlg(“Test”);
    CChildPropertyPage Page1(IDD_PROPPAGE1);
    CChildPropertyPage Page2(IDD_PROPPAGE1,0,0,IDC_GROUP);
    CPropertyPage Page11(IDD_PROPPAGE2);
    CPropertyPage Page12(IDD_PROPPAGE2);
    CPropertyPage Page21(IDD_PROPPAGE3);
    CPropertyPage Page22(IDD_PROPPAGE3);
    dlg.AddPage(&Page1);
    dlg.AddPage(&Page2);
    Page1.AddPage(&Page11);
    Page1.AddPage(&Page12);
    Page2.AddPage(&Page21);
    Page2.AddPage(&Page22);
    

    The CChildPropertyPage constructor takes four arguments:

  • ID of the template used for the page.
  • ID of the name to be placed in the tab for the page. If 0, the name will be taken from the dialog template for this page. Default is 0.
  • The index of the page that will initially be on top. Default is the first page added to the sheet, page 0
  • ID of control in which the child property sheet has to fit. If 0, then the child property sheet fills the entire page. Default is 0.
  • Downloads

    Download demo project – 6 Kb

    Download source – 2 Kb

    CodeGuru Logo

    CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

    Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

    Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.