SplitterWnd
C / C++ / MFC
2
Posts
2
Posters
0
Views
1
Watching
-
Hi I have used splitterwnd in my program and created two panes and split one of the panes into two views.Now I want to change the views in the second pane by changing options in the first pane.How can I do it Thank you
Create your class derived from CSplitterWnd. add a funtion ChangeView to it. Use this class to split and change your view.
ChangeView(int row, int col, CRuntimeClass* pViewClass) { ASSERT(pViewClass->IsDerivedFrom(RUNTIME_CLASS(CView))); CView* pView = STATIC_DOWNCAST(CView, GetPane(row, col)); CFrameWnd* pFrame = pView->GetParentFrame(); ASSERT(pFrame); // set up create context to preserve doc/frame etc. CCreateContext cc; memset(&cc, sizeof(cc), 0); cc.m_pNewViewClass = pViewClass; cc.m_pCurrentDoc = pView->GetDocument(); cc.m_pNewDocTemplate = cc.m_pCurrentDoc ? cc.m_pCurrentDoc->GetDocTemplate() : NULL; cc.m_pCurrentFrame = pFrame; DeleteView(row, col); // delete old view VERIFY(CreateView(row, col, // create new one pViewClass, CSize(0,0), // will fix in RecalcLayout &cc)); RecalcLayout(); // recompute layout // initialize the view CWnd* pWnd = GetPane(row, col); if (pWnd) pWnd->SendMessage(WM_INITIALUPDATE); }
Regards Anil