Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
These program creates splitter windows using CSplitterWnd class, but the problem is that the views fills the entire desktop rather that the parent frame windows. Each pane is of type CformView. Please what am I dong wrong.

Noe that the frme wnd I am trying to split is not that main window, it is a child of the main window. It is being created using CWnd::Create function

C++
BOOL MyFrameWnd::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
	m_pWnd = NULL;
	m_pParent  = this;

	// Create a static splitter with two panes, one above , the other below
	if(!m_Splitter.CreateStatic(this,2,1,WS_CHILD))
	{
		return FALSE;
	}

	//Calculate the size of the splitter
	SIZE top, bottom;
	CRect rect;
	GetClientRect(&rect);

	top.cx = rect.right;
	top.cy = 2 * (rect.bottom - m_Splitter.GetHeight()) / 10;

	bottom.cx = rect.right;
	bottom.cy = 8 * (rect.bottom - m_Splitter.GetHeight()) /10;

	//Create panes
	m_Splitter.CreateView(0,0,RUNTIME_CLASS(StudRegTop),top,pContext);
	m_Splitter.CreateView(1,0,RUNTIME_CLASS(StudRegBottom),bottom,pContext);
		
	//Set Active view
	SetActiveView((CView *)m_Splitter.GetPane(0,0));

	m_Splitter.ShowWindow(SW_NORMAL);
	m_Splitter.UpdateWindow();

	return CFrameWndEx::OnCreateClient(lpcs, pContext);
}
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900