Click to See Complete Forum and Search --> : CSplitterView


Johnny DeMichael
April 17th, 1999, 11:03 AM
Can you create splitter window using SDI? Or do you have to use MDI? Only examples I can find are MDI. Any examples I could study? thanks for any help.

mihai
April 17th, 1999, 12:19 PM
No.
Add in your SDI view a CSplitterWnd m_wndSplitter member. Add handlers for Create fucntions, adn OnSize. Use the snippet:

BOOL CXX2View::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
if (CWnd::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext))
{
m_wndSplitter.CreateStatic(this,1,2);
m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CEditView),CSize(128,0),pContext);
m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(CEditView),CSize(0,0),pContext);
}
return TRUE;
}

void CXX2View::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);
if (m_wndSplitter.GetSafeHwnd())
m_wndSplitter.MoveWindow(0,0,cx,cy);

}

Sincerely, Mihai

Johnny DeMichael
April 19th, 1999, 11:32 AM
Thanks for your help!