I want to switch multiple CSplitterWnd in MFC SDI project.
There are two CSplitterWnd members in CMainFrame.
CSplitterWnd m_wndSplitter;
CSplitterWnd2 m_wndSplitter2;
CSplitterWnd2 is derived from CSplitterWnd class.
And i created both splitters in CMainFrame::OnCreateClient like this.
> BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/,
CCreateContext* pContext)
{
m_wndSplitter.CreateStatic(this,1, 2);
m_wndSplitter.CreateView(0,0, RUNTIME_CLASS(CSplitterWindowView), CSize(300,300), pContext);
m_wndSplitter.CreateView(0,1, RUNTIME_CLASS(CMyView1), CSize(300,300), pContext);
m_wndSplitter2.CreateStatic(this, 1, 2);
m_wndSplitter2.CreateView(0, 0, RUNTIME_CLASS(CMyView2), CSize(300, 300), pContext);
m_wndSplitter2.CreateView(0, 1, RUNTIME_CLASS(CMyView3), CSize(300, 300), pContext);
return TRUE;
}
This is what the screen looks like when i run it.
showing m_wndSplitter2
it only shows m_wndSplitter2.
Now i want to switch to m_wndSplitter through the menu.
When i click the menu, the screen should be like this.
showing m_wndSplitter
i tried ShowWindow(SW_HIDE) and ShowWindow(SW_SHOW) but it doesn’t work.
void CMainFrame::OnMenuSplitter1() //menu event handler
{
m_wndSplitter.ShowWindow(SW_SHOW);
m_wndSplitter2.ShowWindow(SW_HIDE);
}
the screen after call event handler was same as [showing m_wndSplitter2].
김지완 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.