• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 432
  • Last Modified:

MDI app with main frame split in two

Ah hello.

I have an MDI app that I would like to have like an "output" section at the bottom, very much like VC++ 6.0.  This should be resizable, but does not not need to be dockable, although should have the capability to be hidden/closed.  Ideally it should house a list control that I can output text to.

Each of my MDI child window has two vertical splitters, making it have in essence three columns.  I am thinking I could possibly use splitters again on the main frame, but am not sure how.

Obviously, if the "output"  pane is visible, maximising a child window should only take up the remainder of the main frame's space and not all of it as per normal.

Anyone have any ideas on this ?

TIA
0
mrwad99
Asked:
mrwad99
  • 6
  • 4
2 Solutions
 
Jaime OlivaresCommented:
I suggest to use a sizing control bar instead. Have a look to:
http://www.codeproject.com/docking/sizecbar.asp
0
 
mrwad99Author Commented:
Thanks Jaime, I have played with that and it is what I wanted.  However, I am always aprehensive about using the work of others.

How would I do this if I did not use a custom class ?  Could I split the main frame in two, with one half being used for my output pane and the other half being used for the child windows ?
0
 
Jaime OlivaresCommented:
It is not the work of others, it is the right choice according the Microsoft Sytle Guide....

But if you want another alternative, I think you can try something like this (I have tried just with SDI):

BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
      if (!m_wndSplitter.CreateStatic(this, 1, 2))
            return FALSE;
      if (!m_wndSplitter.CreateView(0, 0, someviewclass, CSize(150, 100), somecontext))
            return FALSE;
      if (!m_wndSplitter.CreateView(0, 1, pContext->m_pNewViewClass, CSize(100, 100), pContext))
            return FALSE;
      SetActiveView((CView*)m_wndSplitter.GetPane(0,1));

      return TRUE;
}
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
mrwad99Author Commented:
Thanks again Jaime.

I have tried that and found that it does not work as expected for an MDI app; effectively the MDI-ness is removed and the app reverts to SDI.  

Why is this ?

TIA
0
 
mrwad99Author Commented:
Further details; each child window is split in three with OnCreateClient, so there are three columns.  Could this be something to do with it ?
0
 
Jaime OlivaresCommented:
>each child window is split in three with OnCreateClient, so there are three columns.  Could this be something to do with it ?
No, I don't think so, and still suggest to use first approach. Also will be easier to hide than a splitter (splitters doesn't hide at all, just reduce to minimum size)
0
 
mrwad99Author Commented:
So do you know what causes this behaviour, or shall I throw this open to others ?  Either way you still get points, as I will end up using the first solution.  I want this issue solved for learning purposes :)
0
 
Jaime OlivaresCommented:
I think (by reviewing source code) that MDI is not prepared to manage a splitted pane as the background for many MDI Child windows....
0
 
mrwad99Author Commented:
Thanks; I will leave this open in case anyone else has input for a while.
0
 
AndyAinscowCommented:
Do I understand correctly.
You want this output bar to be shared between the MDI doc/views ?
You want this output bar to be at the bottom of the child area of the MainFrame ?


<I may be remebering some things incorrectly, it's a while since I had to do some spelunking in the MFC code in this area).

If yes AND you can put up with it not being resizing then I would suggest you create a child dialog (of the main frame).  In the OnSize of the main frame you position and size this dialog at the bottom of the child area AND you modify the size of the internal child window that is the client area.  (A MDI app has a child window covering the client area.  Normally you don't interact with this window at all - look at the MFC code)  This should give you shared output bar and the MDI child frames should be created in the now reduced client area.
0
 
mrwad99Author Commented:
Thanks for that all; Andy if I have any further questions on your possible solution I will link to them here.

Cheers.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now