我有一个SDI程序,开始的时候把窗口切割为3个部分
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/,
CCreateContext* pContext)
{
m_CreatedOK = m_HSplitter.CreateStatic(this, 2, 1);
if(m_CreatedOK){
m_CreatedOK = m_HSplitter.CreateView(1, 0, RUNTIME_CLASS( messageView ), 
CSize(0, 0), pContext);//这个是下面的第3个窗口
if(m_CreatedOK){
m_CreatedOK = m_VSplitter.CreateStatic(&m_HSplitter, 1, 2, 
WS_CHILD | WS_VISIBLE, m_HSplitter.IdFromRowCol(0, 0));
if(m_CreatedOK){
m_CreatedOK = m_VSplitter.CreateView(0, 0, 
RUNTIME_CLASS(cardView), CSize(200, 0), pContext);//左上的树形控件
if(m_CreatedOK){
m_CreatedOK = m_VSplitter.CreateView(0, 1, 
RUNTIME_CLASS(contentView), CSize(0, 0), pContext);//右上的属性窗口
setLayout();//设置高度
}
}
}
} return m_CreatedOK ==0 ? false : true;
}
     
左边是一个树,右边是一个属性表
————------------------------------------------------------
    |               |processlist/filemanager/servermanager
   |               |           /           /
    user1           |
    user2           |
                    |
                    |
其中processlist和filemanager和servermanager是三个属性页
现在我想点不同的用户的时候,右边的属性页能进行刷新,
我该怎么做呢?
我开始试过想process发送消息可是没有成功,不知道该怎么解决
希望有人能指教一下,先谢谢了

解决方案 »

  1.   

    //说下用过的一个方法首先在CMainFrame中定义函数CContentView*  GetContentViewPtr();  //获得CContentView类的指针CContentView* CMainFrame::GetContentViewPtr()
    {
        return (CContentView*)m_VSplitter.GetPane(0,1);
    }然后在CCardView中定义个成员变量 CContentView*  m_pContentView;  //保存CContView类的指针
    void CCardView::OnInitialUpdate()  //在CCardView的初始化函数中为m_pContentView赋值
    {
       CMainFrame* pMainFrame = (CMainFrame*)AfxGetMainWnd();
       m_pContentView = pMainFrame->GetContentViewPtr();
       ...
    }然后在TreeView的TvnSelchanged函数中
    if(...)  //根据不同的选项设置CContentView不同属性页显示
       m_pContentView->SetAcitvePage(...);
      

  2.   

    我还是不是很明白,我在CMainFrame中定义函数CContentView*  GetContentViewPtr();  怎么是错的呢?
      

  3.   

    c:\documents and settings\administrator\桌面\testcard.1\mainfrm.h(33) : error C2143: syntax error : missing ';' before '*'
    c:\documents and settings\administrator\桌面\testcard.1\mainfrm.h(33) : error C2501: 'contentView' : missing storage-class or type specifiers
    c:\documents and settings\administrator\桌面\testcard.1\mainfrm.h(33) : error C2501: 'GetContentViewPtr' : missing storage-class or type specifiers
    c:\documents and settings\administrator\桌面\testcard.1\mainfrm.cpp(175) : error C2556: 'class contentView *__thiscall CMainFrame::GetContentViewPtr(void)' : overloaded function differs only by return type from 'int *__thiscall CMainFrame::GetConten
    tViewPtr(void)'
            c:\documents and settings\administrator\桌面\testcard.1\mainfrm.h(33) : see declaration of 'GetContentViewPtr'
    c:\documents and settings\administrator\桌面\testcard.1\mainfrm.cpp(175) : error C2371: 'GetContentViewPtr' : redefinition; different basic types
    testCard.cpp
    c:\documents and settings\administrator\桌面\testcard.1\mainfrm.h(33) : error C2143: syntax error : missing ';' before '*'
    c:\documents and settings\administrator\桌面\testcard.1\mainfrm.h(33) : error C2501: 'contentView' : missing storage-class or type specifiers
    c:\documents and settings\administrator\桌面\testcard.1\mainfrm.h(33) : error C2501: 'GetContentViewPtr' : missing storage-class or type specifiers
    testCardDoc.cpp
    testCardView.cpp
    TrueColorToolBar.cpp
    Error executing cl.exe.
      

  4.   

    在主框架类的头文件中,包含CContentView的头文件
    #include "CContentView.h"
      

  5.   

    Documents and Settings\Administrator\桌面\testCard.1\cardView.cpp(349) : error C2039: 'SetAcitvePage' : is not a member of 'contentView'
    可是又出现了这个错误
      

  6.   

    //if(...)  //根据不同的选项设置CContentView不同属性页显示 
    //   m_pContentView-> SetAcitvePage(...);不好意思,这句话写错了
    获得了右边View类的指针,然后控制Sheet上的page显示应该不难吧