静态切分窗口怎的切换视图

静态切分窗口怎样切换视图
切分窗口1

最开始右侧编辑框为0,
单击右侧的按钮,编辑框改为输入值,并保存

void CFirstView::OnButton1() 
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);

}

此时,保存的数据为12
单击左侧的按钮2,切换另一视图

在此单击左侧按钮1,显示第一视图,编辑框又重置为0


我这里采用的是DeleteView和CreateView
C/C++ code

void CMainFrame::OnSwitchToSecond()
{
    m_wndSplitter.DeleteView(0,1);
    m_wndSplitter.CreateView(0,1,RUNTIME_CLASS(CSecondView), CSize(0,0),NULL);
    m_wndSplitter.RecalcLayout();
}


我想实现切换右侧视图时,视图中原来的数据仍然保存,应该怎样实现?
更进一步,右侧如果一个是子Splitter,一个是普通视图类,怎样保证自己的数据。
有显示和隐藏的函数吗?

------解决方案--------------------
参考:
C/C++ code

//
BOOL CMainFrame::ChangeView(CRuntimeClass *pNewViewClass)
{
    CCreateContext Context;// I hate 'new'
    ZeroMemory(&Context,sizeof(Context));
    Context.m_pCurrentFrame=this;
    Context.m_pCurrentDoc=GetActiveDocument();
//
    CRect rect;
    GetClientRect(&rect);
    CSize size=rect.Size();
    size.cx /= 2;// col
    size.cy /= 3;// row
//
    int Row,Col;
    m_wndSplitter2.LockWindowUpdate();
//
    m_wndSplitter2.GetActivePane(&Row,&Col);
    m_wndSplitter2.DeleteView(Row,Col);// focus move to next !
    m_wndSplitter2.CreateView(Row,Col,pNewViewClass,size,&Context);
    m_wndSplitter2.RecalcLayout();
// send 'InitialUpdate' to view
    InitialUpdateFrame(NULL,TRUE);
// no flush
    m_wndSplitter2.SetActivePane(Row,Col);
//
    m_wndSplitter2.UnlockWindowUpdate();
//
    return TRUE;
}

------解决方案--------------------
左边用视图类,右边用框架类,在框架里添加视图,使用GetPane保存当前的。
在左侧的view类里保存右边框架视图的指针,成员变量
CRightPaneFrame* m_pRightPaneFrame;
C/C++ code

    CLeftPaneView* pLeftPaneView     = (CLeftPaneView*)   m_wndSplitter.GetPane(0,0);
    pLeftPaneView->m_pRightPaneFrame = (CRightPaneFrame*) m_wndSplitter.GetPane(0,1);
    
    // Set the left pane as the active view
    SetActiveView((CView*) m_wndSplitter.GetPane(0, 0));