• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 176
  • Last Modified:

Enquery about Tab Control

hi, i'm a newbie to visual c++ and needs some expert guidance :)
i am adding controls to a dialog using control toolbars, but when i try to use drag and put the Tab Control onto my dialog, i discover that it actually gave me 5 tabs and i can't find way to change that.
i would like to

1) Change the number of tab to 3 instead of 5
2) Instead of tag being name "Tag 1", "Tag 2", "Tag 3", how can i set the name to like eg. "Graphs", "Forms", "Values"?

Any help would be greatly appreciate. Thanks.
0
Kyoshiro
Asked:
Kyoshiro
  • 2
  • 2
1 Solution
 
AlexFMCommented:
Tab control is shown by such way in dialog template. Actually it doesn't have tabs, they should be added programmatically. Add class member fot this tab control (for example, m_tab_ctrl) and add the following lines to OnIntiDialog:

m_tab_ctrl.InsertItem(0, "Item 0");
m_tab_ctrl.InsertItem(1, "Item 1");

Now the control has 2 tabs.
0
 
KyoshiroAuthor Commented:
Ic. Thanks Alex, i now get the idea of the Tag control having to be program. But i still don't get what you meant by
1) "Add class member fot this tab control (for example, m_tab_ctrl)"

2) "add the following lines to OnIntiDialog:
m_tab_ctrl.InsertItem(0, "Item 0");
m_tab_ctrl.InsertItem(1, "Item 1");"

erm, can you explain more on 1)?
About 2), do you mean adding both those lines in the
e.g.
/* BOOL CFYPDlg::OnInitDialog()
  {
     CDialog::OnInitDialog();
*/ ?

Thanks again.
0
 
AlexFMCommented:
1) View - Class Wizard - Member Variables. Select your class in Class name combo. Select tab control ID in list. Click Add Variable. Fill variable name m_tab_ctrl.

2) I suppose you have already function OnInitDialog. Add two lines before the line

return TRUE;
0
 
KyoshiroAuthor Commented:
Yes~. Thanks pal. Thanks for the help :)
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now