Hi All I create a SDI project to implement splitting window using CSplitterWnd and OnCreateClient (VC 6.0). In MainFrm.h, two CSplitterWnd member variables are declared
public:
CMySplitter wndSplitter_horizontal;
CMySplitter wndSplitter_erect;
In MainFrm.cpp the OnCreateClienct function is as follows
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
// TODO: Add your specialized code here and/or call the base class
if(wndSplitter_horizontal.CreateStatic(this,2,1)==NULL)
return FALSE;
wndSplitter_horizontal.CreateView(0,0,RUNTIME_CLASS(CMonitorTopView),CSize(50,50),pContext);//CMonitorTopView CViewLeft
if(wndSplitter_erect.CreateStatic(&wndSplitter_horizontal,1,2,WS_CHILD|WS_VISIBLE, wndSplitter_horizontal.IdFromRowCol(1, 0))==NULL)
return FALSE;
wndSplitter_erect.CreateView(0,0,RUNTIME_CLASS(CViewRight),CSize(220,220),pContext);//CMonitorRightView
wndSplitter_erect.CreateView(0,1,RUNTIME_CLASS(CViewRight),CSize(220,220),pContext); //CMonitorRightView
return TRUE;
}
It works fine when a CEditView based view 'CViewRight' or 'CViewLeft' is linked to the pane with CreateView(), but failed when a CFormView based view 'CViewRight_Dlg1111' , 'CMonitorTopView' or 'CMonitorRightView' is linked to the pane, though compiling is successful. 'CViewRight_Dlg1111' is created as follows, (1) First create a dialog resource (IDD_Dlg_1111) (2)Invoke the 'New Class' dialog box Class Type: MFC class Base Class: CFormView Dialog ID: IDD_Dlg_1111 Creating 'CMonitorTopView' and 'CMonitorRightView' follows the same way. Also, I find that the program works fine when classes derived from CEditView, CTreeView, CView are linked to the pane . i do not know why. Please help I would like the program to deploy the multi-pane layout only when the user clicking a menu item, How to do this.