Click to See Complete Forum and Search --> : Static splitter in a view class


Anuj Seth
May 6th, 1999, 04:53 AM
Env: Win NT 4.0, VC++ 6.0, MFC

Hi,

For a project I'm developing, I need to create a static splitter in the view
and not in the MainFrame. To try and do this, I wrote the following code,


int CSplitterView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;

CCreateContext* pContext = (CCreateContext*)lpCreateStruct->lpCreateParams;

if( !m_wndSplitter.CreateStatic(this, 2, 2) ||
!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CMyView1), CSize(128, 128),
pContext) ||
!m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CMyView2), CSize(128, 128),
pContext) ||

!m_wndSplitter.CreateView(1, 0, RUNTIME_CLASS(CMyView3), CSize(128, 128),
pContext) ||
!m_wndSplitter.CreateView(1, 1, RUNTIME_CLASS(CMyView4), CSize(0, 0),
pContext))

{
TRACE("Error\n");
}

return 0;
}




*BUT*, this code does not work. I does not give an error, but the splitters
don't show up! The same code works fine when put in the CMainFrame class.

I need to implement it in a view class only, and have not been able to do
so.

Could you guys help me out with this.

Thanks,

With Regards,

Anuj Seth