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

  • On-demand Event Event Date: September 10, 2014 Modern mobile applications connect systems-of-engagement (mobile apps) with systems-of-record (traditional IT) to deliver new and innovative business value. But the lifecycle for development of mobile apps is also new and different. Emerging trends in mobile development call for faster delivery of incremental features, coupled with feedback from the users of the app "in the wild." This loop of continuous delivery and continuous feedback is how the best mobile …

  • Not all enterprise applications are created equal. Sophisticated applications need developer support but other more basic apps do not. With the right tools, everyone is a potential app developer with ideas and a perspective to share. Trends such as low-code development and model driven development are fundamentally changing how and who creates applications. Is your organization ready? Read this report and learn: The seven personas of enterprise app delivery How application ownership is spreading to the …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds