views:

497

answers:

2

In my MFC program I am using a splitter to create two panes. I now want to split one of these panes in half again and put in another view, can someone talk me through how to do it or point me in the direction of some code?

I would prefer to code it myself so I am not interested in custom derived classes unless they are extremely basic.

Thanks!

A: 

I am not an expert in MFC, but can't you just put a splitter in one of the panes you made with the first splitter ? that how we do in winform....

pmlarocque
No, the initial splitting is done in mainfrm and views are associated with the panes there.
Konrad
+1  A: 

In CMainFrame::OnCreateClient

// Create splitter with 2 rows and 1 col
m_wndSplitter.CreateStatic(this, 2, 1);
// Create a view in the top row
m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CView1), CSize(100, 100), pContext);
// Create a 2 column splitter that will go in the bottom row of the first
m_wndSplitter2.CreateStatic(&m_wndSplitter, 1, 2, WS_CHILD|WS_VISIBLE, m_wndSplitter.IdFromRowCol(1, 0));
// Create views for the bottom splitter
m_wndSplitter2.CreateView(0, 0, RUNTIME_CLASS(CView2), CSize(100, 100), pContext); 
m_wndSplitter2.CreateView(0, 1, RUNTIME_CLASS(CView3), CSize(100, 100), pContext);
...
Rob
That code raises exceptions when run. :(
Konrad
Try this: m_wndSplitter2.CreateStatic(
Rob
Rob you are awesome :D Can't tell you how long I have been struggling with that today :D
Konrad