动态添加wxPanel到sizer而不刷新窗格

时间:2015-05-09 22:18:06

标签: c++ user-interface wxwidgets

enter image description here我正在尝试动态添加和删除wxPanel到sizer,具体取决于在树控件中单击的项目,页面是否已添加,但是当我添加面板时,之前的内容未被删除清除,我使用以下代码:

void ManageProjectMain::SelectSubPageReleaseDetails()
{
    switch( m_activePage )
    {
    case ProjectMainSubPage_releaseDetails:
        break;

    case ProjectMainSubPage_cycleDetails:
        m_sizer->Detach( 0 ); 
        m_releaseCycleDetailsPane->Hide();
        m_sizer->Prepend( m_releaseDetailsPane, 1, wxGROW );
        m_releaseDetailsPane->Show();
        break;

    case ProjectMainSubPage_folderDetails:
        m_sizer->Detach( 0 ); 
        m_releaseFolderDetailsPane->Hide();
        m_sizer->Prepend( m_releaseDetailsPane, 1, wxGROW );
        m_releaseDetailsPane->Show();
        break;
    }

    m_activePage = ProjectMainSubPage_releaseDetails;
    m_sizer->Layout();
    m_releaseDetailsPane->Refresh();
}

任何帮助都将不胜感激。

1 个答案:

答案 0 :(得分:0)

我不知道这段代码到底出了什么问题,虽然分离和插入页面很奇怪,不应该是必要的。

但是,您可能有兴趣将其完全替换为wxTreebook,或者,如果您想保留构建树的代码,则右侧只需wxSimplebook