jdl
jdl

Reputation: 6333

How to programmatically create/build up a CTabCtrl?

Without using the "Graphic Resources" how can I create and build up a CTabCtrl?

What I have so far creates it, but I don't know the MESSAGE_MAP for it. Also how to create different views for each "tab" as apposed to displaying/hiding controls depending upon what tab was selected?

thx

    CTabCtrl *tabMain = new CTabCtrl();
    tabMain->Create(WS_CHILD|WS_VISIBLE|TCS_TABS|TCS_SINGLELINE,CRect(700,100,1000,600),this,5);

    TC_ITEM ti;
    ti.mask = TCIF_TEXT;
    ti.pszText = _T("Tab0");
    tabMain->InsertItem(0,&ti);
    ti.pszText = _T("Tab1");
    tabMain->InsertItem(1,&ti);
    ti.pszText = _T("Tab2");
    tabMain->InsertItem(2,&ti);

Upvotes: 0

Views: 1319

Answers (1)

Jeeva
Jeeva

Reputation: 4663

The last parameter you pass to the Create function is the Id which you should use in the MESSAGE_MAP .

For eg:

ON_NOTIFY(TCN_SELCHANGE, 5 , OnSelchangeTab)

Upvotes: 1

Related Questions