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 eSeminar DevOps and Cloud are all the rage in IT, but the two terms relating process and computing aren't mutually exclusive. Join us to see how your movement into cloud changes the way you develop, deploy, test and manage, and how DevOps can actually be a good thing when coupled with cloud.

  • On-demand Event Event Date: May 18, 2015 While the idea of using facial and/or gesture recognition to create a modern, intuitive game seems attractive, some developers may want to leverage Unity 3D as a way to accelerate their development efforts. There are many different ways in which Intel and Unity Technologies have been working together to help speed the development of games with the Intel&reag; RealSense™ SDK (software developer kit). Check out this webcast to join a panel of experts as they …

Most Popular Programming Stories

More for Developers

RSS Feeds

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