Menu

CTab::SetTabsAtTop Doesn't Work for me V880 :(

Help
Erik Don
2021-01-13
2021-01-13
  • Erik Don

    Erik Don - 2021-01-13

    Hi, all
    I have try to modify demo splitter to add CTab in one panel,
    the added code as follow. If I don't add code (1)/(2) every thing will be fine, but I need the tab button at the bottom , than code (1)/(2) added for this purpose, unfortunately none of this works for me, I aways get assertion. than have to refer to TabDemo, than code (new) part added, but same error.
    Have I missed any additional code to enable this purpose or something else?
    CDockList::CDockList()
    {
    //SetView(m_view);
    //m_tabView.AddTabPage(&m_view, _T("Classes"));

    (new)// Turn on the tab's owner draw and fixed width tabs
    //m_tab.SetFixedWidth(TRUE);
    //m_tab.SetOwnerDraw(TRUE);
    //m_tab.SetShowButtons(TRUE);
    

    (1)--> //m_tab.SetTabsAtTop(FALSE);
    m_tab.AddTabPage(new CViewList, _T("List view"));
    m_tab.AddTabPage(new CViewTree, _T("Tree view"));
    m_tab.AddTabPage(new CDockText, _T("Text view"));
    SetView(m_tab);

    m_tab.SelectPage(0);
    

    (2)-->m_tab.SetTabsAtTop(FALSE);

     
  • David

    David - 2021-01-13

    Hi Eric

    The calls to SelectPage and SetTabsAtTop cause asserts in CDockList's constructor because the CTab window hasn't been created yet.

    We can fix that by overriding OnInitialUpdate and moving the code there.

    void CDockList::OnInitialUpdate()
    {
        m_tab.SelectPage(0);
        m_tab.SetTabsAtTop(FALSE);
    }
    

    Best regards,
    David

     
  • Erik Don

    Erik Don - 2021-01-13

    Hi, David
    Thank you very much, now it works :)

     

Log in to post a comment.