Have one simple view and one split view in MFC

991 views Asked by At

I have a multiple view SDI project. One of the views has to be split, probably with CSplitterWnd or CSplitterWndEx. But the other views should not be split, and should not have the split buttons and scrollbars. I tried various combinations using CSplitterWnd and some classes derived from it which I found online, but I can't get what I need. So here are the constraints:

  1. One view is CViewUnsplit, without splitter

  2. The second view displays initially only CViewSplitLeft

  3. A command allows the user to split/unsplit and add or remove CViewRight.

Split the second view only

1

There are 1 answers

0
xMRi On

It should work in the following way.

  1. The first is CViewUnsplit is just the way a simple SDI application comes up.

  2. The second switched view can be easily achived in just swapping the view. This is well documented. The basics are shown here in this sample with two views http://msdn.microsoft.com/en-us/library/s199bks0.aspx

  3. The third is a little tricky. Just create the splitter and place the CViewSplitLeft with SetParent into the left splitter part. The right view can always stay in the splitter. Again here the splitter is just hidden in the main window. When you switch back to another view just Use SetParent again and move the CViewSplitLeft to the CMainFrame.

Always just hide all unneeded views. Take care about the IDs of the views as shown in the sample. Otherwise the resizing will not work.