I am extending CTabCtrl but but cant insert any tabs

115 views Asked by At

I am extending CTabCtrl but when I call InsertItem on my extended object none tab gets inserted. Who knows why is that. What do I do wrong?

class MyTabControl : public CTabCtrl
{
public:
    MyListControl       m_listCtrl;
    void                switchInterface(IDataProvider *provider);
public:
    MyTabControl();
    ~MyTabControl();
    afx_msg void OnGetDispInfo(NMHDR *pNMHDR, LRESULT *pResult);
protected:
    afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
    DECLARE_MESSAGE_MAP()
};

If I remove ON_WM_CREATE() macro from message map then I can add tabs. Implementation of OnCreate function contains m_listCtrl.Create() function call and return 0 if list control is created successfully. What is wrong with this?

1

There are 1 answers

0
sergiol On

The CTabCtrl class is terribly old and poorly functional; you will have to do all the showing/hiding logic of controls when user is switching from one tab to another by your own hand. I recommend you to extend from CMFCTabCtrl instead.