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

  • It's not unusual for a company to use a variety of formal and informal file-sharing methods. Many methods are fraught with significant operational, financial, and legal risks in addition to other potentially negative business consequences. Strategic managed file transfer (MFT) software and services help connect the business "dots" between the various ad hoc and more systematic ways that files are moved. Read this white paper to learn how the right MFT solution, can bring order, structure, and, importantly, …

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds