|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
|
Announcements
Want a new Job?
Chapters
Services
Feature Zones
|
IntroductionI first submitted this code and article way back in Feb '99 and Jul '99 on the CodeGuru site. Wow, do the years go by fast! It's still there and going strong, and I still use the control today in newer projects that I've worked on since the one in whcih the control first turned up in. I've never had a need to change the code so far, but have decided to re-submit here on CodeProject. Anyway, a lot of projects that I've working make use of tab controls, and on the tab pages there are typically up to 10 controls! And using the
The
Note Steps 1, 2 & 3 are typically done in the parent dialogs // file : SomeDialogClass.h class CSomeDialogClass : public CDialog { CSTabCtrl m_TabCtrl; CTreeCtrl m_TreeCtrl; CListCtrl m_ListCtrl; CComboBox m_ComboCtrl; virtual BOOL OnInitDialog(); }; // file : SomeDialogClass.cpp BOOL CSomeDialogClass::OnInitDialog() { CDialog::OnInitDialog(); //////////////////////////////////////////////////////// // set up tabs. PSTR pszTabItems[] = { "Tab Sheet 1 : Tree control", "Tab Sheet 2 : List control", "Tab Sheet 3 : Combobox control", NULL }; TC_ITEM tcItem; for(INT i = 0; pszTabItems[i] != NULL; i++) { tcItem.mask = TCIF_TEXT; tcItem.pszText = pszTabItems[i]; tcItem.cchTextMax = strlen(pszTabItems[i]); m_TabCtrl.InsertItem(i,&tcItem); } // attach controls to tabs pages. // attach tree control to first page m_TabCtrl.AttachControlToTab(&m_TreeCtrl,0); // attach list control to second page m_TabCtrl.AttachControlToTab(&m_ListCtrl,1); // attach combo box control to third page m_TabCtrl.AttachControlToTab(&m_ComboCtrl,2); // initialize tab to first page. m_TabCtrl.SetCurSel(0); //////////////////////////////////////////////////////// } Anyway...hope this is of use to everyone!
|
||||||||||||||||||||||