Using a modeless property sheet as a 'view' in a Frame

Using a Property Sheet as a 'view' inside a child frame window turns out to be quite simple.

  1. Derive your own class from CPropertySheet.
  2. Override virtual OnInitDialog as follows.

BOOL CModelessPpsh::OnInitDialog()
{
	m_bModeless = FALSE;
	BOOL bResult = CPropertySheet::OnInitDialog();
	m_bModeless = TRUE;

	return bResult;
}

This will do the trick, fooling CPropertySheet Class into thinking it deals with modeless type. The HELP button will be shown only if you handle help commands in your project. For example: ON_COMMAND(ID_HELP, CMDIFrameWnd::OnHelp) etc.

Download the sample. This is only an example, I did not deal with View and Document classes. The sample contains a project, and BMP of the app in a 53K zip file:

Last updated: 30 June 1998



About the Author

John Z. Czopowik VC++ MVP

Microsoft VC++ MVP

Comments

  • Brilliant Stuff, Scroll Bars Missing

    Posted by Legacy on 06/11/2003 12:00am

    Originally posted by: Rahul Verma

    The stuff is brilliant, and manipulative for you can really surpass the existing doc/view and proceed on to create your own property sheets and tabs based stuff. What I was thinking is that how do you add a scroll bar to child frame, CChildFrame so that it helps in scrolling a large property sheet.

    Thanks
    rahul.

    Reply
  • Thank you,But..

    Posted by Legacy on 07/27/2002 12:00am

    Originally posted by: Eric Lee

    Thank you,

    That's help me a lot.

    You are a very very good guy..


    But it's has a small bug,

    That is, the first page can't see when the property sheet shown first time.

    And I changed it as below:

    BOOL CModelessPpsh::OnInitDialog()
    {
    m_bModeless = FALSE;
    BOOL bResult = CPropertySheet::OnInitDialog();
    m_bModeless = TRUE;
    SetActivePage(0); // Add this line
    return bResult;
    }

    The problem has been fixed.

    Reply
  • THank u :)

    Posted by Legacy on 06/16/2002 12:00am

    Originally posted by: Kalain

    Thank u for share us this great idea;
    It is help me so much;
    Thank u,
    U are a good guy; :)

    Reply
  • thx

    Posted by Legacy on 07/27/2001 12:00am

    Originally posted by: Alexey Shetinin

    Thanks, that exactly what i need :)

    Reply
  • What do you do about Save, Save As, Close, Etc.?

    Posted by Legacy on 03/01/1999 12:00am

    Originally posted by: Bill McNeese

    If the base class in the following function is not called,
    
    then how does one get the Save, Save As, etc. to work?

    If the base class is called, the property sheet is covered by
    a different view. If not called, the serialization and printing
    functions remain grayed.

    BOOL CChildFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
    {
    // do not call base class!
    //return CMDIChildWnd::OnCreateClient(lpcs, pContext);
    m_pPg1 = new CPg1();
    m_pPg2 = new CPg2();

    m_Ppsh.AddPage(m_pPg1);
    m_Ppsh.AddPage(m_pPg2);

    m_Ppsh.Create(this, WS_CHILD);
    m_Ppsh.ShowWindow(SW_SHOW);

    CRect clientRect;

    return TRUE;
    }

    Reply
  • This doesn't work with CSplitterWnd...

    Posted by Legacy on 01/07/1999 12:00am

    Originally posted by: Richard Lyle

    Because the created class is not dervived from CView, a ASSERT fails in the CSplitterWnd code.

    I'am working on a solution... will post it if I find the problem.

    Reply
  • This doesn't work with CSplitterWnd ?

    Posted by Legacy on 01/07/1999 12:00am

    Originally posted by: John Z. Czopowik

    Could you be more explicit and specify what exactly does not work?

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

Top White Papers and Webcasts

  • Organizations are increasingly gravitating toward mobile-first application development as they assess the need to revamp their application portfolios to support touch computing and mobility. Consumerization has brought higher expectations for application usability along with the mobile devices themselves. Enterprises are increasingly shifting their new application acquisitions and development efforts toward mobile platforms. With this backdrop, it is natural to expect application platform vendors to invest in …

  • Cloud computing isn't new, but it's still a hot topic in technology circles. Moving to the cloud has done great things for many businesses. When it comes to handling a basic business necessity, cloud computing has brought many improvements to overall business continuity. Using the cloud for DR makes a lot of sense for many, but it's not exactly the most simple concept. Read this eBook to find answers to all the key questions IT professionals have about cloud-based disaster recovery, and helpful info around the …

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date