0

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?

maniak
  • 21
  • 2

1 Answers1

0

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.

sergiol
  • 4,122
  • 4
  • 47
  • 81