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

  • Live Event Date: December 11, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT Market pressures to move more quickly and develop innovative applications are forcing organizations to rethink how they develop and release applications. The combination of public clouds and physical back-end infrastructures are a means to get applications out faster. However, these hybrid solutions complicate DevOps adoption, with application delivery pipelines that span across complex hybrid cloud and non-cloud environments. Check out this …

  • VMware vCloud® Government Service provided by Carpathia® is an enterprise-class hybrid cloud service that delivers the tried and tested VMware capabilities widely used by government organizations today, with the added security and compliance assurance of FedRAMP authorization. The hybrid cloud is becoming more and more prevalent – in fact, nearly three-fourths of large enterprises expect to have hybrid deployments by 2015, according to a recent Gartner analyst report. Learn about the benefits of …

Most Popular Programming Stories

More for Developers

RSS Feeds