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 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


    Comments

    • Excellent - easily fills a severe gap in MFC

      Posted by Legacy on 09/24/2001 12:00am

      Originally posted by: heretic108

      This is the easiest way to use nested property sheets.
      
      

      Fast to learn, and simple to adapt to my needs.

      Reply
    • INITDIALOG troubles

      Posted by Legacy on 04/02/2000 12:00am

      Originally posted by: Polstianko DMITRY

      I tryed creat my class CMyChildPage from CChildPropertyPage.
      I put CViewCtrl inside PropertyPage. All initialization of CViewCtrl I made from CMyChildPage::OnInitDialog(), but CMyChildPage::OnInitDialog() doesnt response :o( . Why ?


      Reply
    • Apply button is not working

      Posted by Legacy on 03/04/2000 12:00am

      Originally posted by: sanjay thakur

      If I create my page derived from CPropertyPage and I include it as child propertypage...if i use SetModified(TRUE) in my child page...then it should enable the Apply button and should call Apply function ..which is not happening..
      Please farword the solution as soon as possible..
      thx in advance..

      Reply
    • Good code, but ... bad design

      Posted by Legacy on 02/17/2000 12:00am

      Originally posted by: P�l Kristian T�nder

      I don't want to be negative, but one should not promote this kind of UI. Having more than one level of property sheets is very confusing for the user, and should be avoided at any cost. An alternative way of doing this is to have a listbox on the left side of the window with the top level sheets as items. Activating one of these present a proerty sheet to the right.

      Reply
    Leave a Comment
    • Your email address will not be published. All fields are required.

    Top White Papers and Webcasts

    • Live Event Date: October 29, 2014 @ 11:00 a.m. ET / 8:00 a.m. PT Are you interested in building a cognitive application using the power of IBM Watson? Need a platform that provides speed and ease for rapidly deploying this application? Join Chris Madison, Watson Solution Architect, as he walks through the process of building a Watson powered application on IBM Bluemix. Chris will talk about the new Watson Services just released on IBM bluemix, but more importantly he will do a step by step cognitive …

    • A modern mobile IT strategy is no longer an option, it is an absolute business necessity. Today's most productive employees are not tied to a desk, an office, or a location. They are mobile. And your company's IT strategy has to be ready to support them with easy, reliable, 24/7 access to the business information they need, from anywhere in the world, across a broad range of communication devices. Here's how some of the nation's most progressive corporations are meeting the many needs of their mobile workers …

    Most Popular Programming Stories

    More for Developers

    Latest Developer Headlines

    RSS Feeds