
Adding a control to a tab control
i suffered like you with the tab control.here's an easier
way of adding controls to a tabcontrol.
ok, here it goes.
Forget about using tabcontrol from the controls
toolbar. only Bill Gates
and the people who know windows api understand it.
PropertySheet is the way
to go.
Note: if you do this from a dialog based app, it wont work
beacause the
original dialog is sitting out there by itself. The
property pages(tab
controls) are created on their own and not on top of the
dialog. so when you
are done with the property sheets the original mfc created
dialog will pop
up. it is to messy trying to clean it up so the property
sheets are glued to
the dialog.
Solution: use sdi or mdi app.
-i used sdi. Insert however many dialogs that you need.
remember these are
the tab controls, if you want 5 tabs on the tabcontrol
insert 5 dialogs. put
the controls you want on the dialog boxes.
-by the way this direction can be found at the
"Using Property Sheets in Your Application".
on each dialog: go to style tab and check only the title
bar,
style tab/style combo box -Child.
style tab/Border combo box -Thin.
More Styles tab/check on Disabled ONLY.
-Create classes to manage dialog boxes, give it a class
name and the base
class should be CPROPERTYPAGE(very crucial).
-define member variables for accessing various controls
that are on the
dialog boxes.
-i created a menu item for the tabcontrol. generated a
menu command message
handler. in the handler function is the following code:
CPropertySheet propSheet("name of the tabcontrol");
CDialog1 dlg1Page;
CDialog2 dlg2Page;
.
.
.
propSheet.addPage(&dlg1Page);
propSheet.addPage(&dlg2Page);
propSheet.doModal();
You can also do modeless.
p.s. there is a way to do this with modal dialog boxes but
I have not had the time to explore it.
Good Luck!