Click to See Complete Forum and Search --> : Splitter window


May 17th, 1999, 04:00 PM
Hi,
I am trying to create a static splitter by declaring a protected variable of class CSplitterWnd in CMainFrame class and
then overriding the OnCreateClient() function to create the window.
I have tried many different ways to make the program run but each and every time it is giving me an assertion failure
in file 'winsplit.cpp'.
The code is:
1) first , I tried....
BOOL CMainFrame::OnCreateClient( LPCREATESTRUCT /*lpcs*/, CCreateContext* pContext)
{
m_wndSplitter.CreateStatic(this, 1,2);
m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CSquareView),CSize(100,100), pContext));

return TRUE;
}

2) Then I tried.........
BOOL CMainFrame::OnCreateClient( LPCREATESTRUCT /*lpcs*/, CCreateContext* pContext)
{
VERIFY(m_wndSplitter.CreateStatic(this,1,2));
VERIFY(m_wndSplitter.CreateView(0,0,RUNTIME_CLASS(CHydraqlView),CSize(100,100), pContext));

return TRUE;
}

3) Then........
BOOL CMainFrame::OnCreateClient( LPCREATESTRUCT /*lpcs*/, CCreateContext* pContext)
{
if (!m_wndSplitter.CreateStatic(this, 1, 2))
{
TRACE0("Failed to CreateStaticSplitter\n");
return FALSE;
}
if (!m_wndSplitter.CreateView(0, 0,pContext->m_pNewViewClass, CSize(130, 50), pContext))
{
TRACE0("Failed to create first pane\n");
return FALSE;
}
return TRUE;
}

Please help..........!
thanks
shachi

Wayne Fuller
May 17th, 1999, 06:05 PM
It looks like your problem is that you are creating a splitter window with two panes but only creating one view. Create the second view and it should work.

Wayne