CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2007
    Posts
    162

    [RESOLVED] Property Sheets on the main dialog

    I have been playing around with property sheets/property pages and have been successful in getting them to work in a secondary dialog by calling the property sheet using DoModal().
    I cannot figure out how to get the property sheet to display on the main dialog of a dialog application.
    I am using VS2008 and CMFCPropertySheet and CMFCPropertyPage.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,396

    Re: Property Sheets on the main dialog

    Did you try Create instead of DoModal?
    Victor Nijegorodov

  3. #3
    Join Date
    Apr 2007
    Posts
    162

    Re: Property Sheets on the main dialog

    Yes I tried this in the OnInitDialog()

    Code:
    // TODO: Add extra initialization here
    	m_dlgMainSheet.AddPage(&m_PageOne);
    	m_dlgMainSheet.AddPage(&m_PageTwo);
    
    	m_dlgMainSheet.Create(this, WS_CHILD | WS_VISIBLE, 0);
    	m_dlgMainSheet.ModifyStyleEx (0, WS_EX_CONTROLPARENT);
    	m_dlgMainSheet.ModifyStyle( 0, WS_TABSTOP );
    Where m_dlgMainSheet is a CMFCPropertySheet declared in the main dialog header file.
    I keep getting a "A required resource is not available" message when I start the app.

  4. #4
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Property Sheets on the main dialog

    Quote Originally Posted by zapper222 View Post
    I have been playing around with property sheets/property pages and have been successful in getting them to work in a secondary dialog by calling the property sheet using DoModal().
    I cannot figure out how to get the property sheet to display on the main dialog of a dialog application.
    I am using VS2008 and CMFCPropertySheet and CMFCPropertyPage.
    In the InitInstance method of app class, replace the default dialog with your propertysheet and call DoModal();

  5. #5
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,620

    Re: Property Sheets on the main dialog

    Quote Originally Posted by zapper222 View Post
    Yes I tried this in the OnInitDialog()

    Code:
    // TODO: Add extra initialization here
        m_dlgMainSheet.AddPage(&m_PageOne);
        m_dlgMainSheet.AddPage(&m_PageTwo);
    
        m_dlgMainSheet.Create(this, WS_CHILD | WS_VISIBLE, 0);
        m_dlgMainSheet.ModifyStyleEx (0, WS_EX_CONTROLPARENT);
        m_dlgMainSheet.ModifyStyle( 0, WS_TABSTOP );
    Where m_dlgMainSheet is a CMFCPropertySheet declared in the main dialog header file.
    I keep getting a "A required resource is not available" message when I start the app.
    You always can debug Create call and see what happens under the hood. But afraid property sheet was not designed to be a child window.
    Best regards,
    Igor

  6. #6
    Join Date
    Apr 2007
    Posts
    162

    Re: Property Sheets on the main dialog

    Quote Originally Posted by Arjay View Post
    In the InitInstance method of app class, replace the default dialog with your propertysheet and call DoModal();
    Yep that's the ticket, thanks Arjay.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured