Adding a control to a tab control 
Author Message
 Adding a control to a tab control

I am having a really rough time trying to add a treecontrol to on of the
tabs on a tab control. I can do this easily in any language but VC++ because
it seems like I cant drag and drop the control onto the tab. Is this the
case. How would I add a tree control to a tab on a tab control. Visually or
in code. Thanks in advance. An examples or places where I can get good
examples
would be appreciated.

Ryan Taylor



Sat, 31 Jan 2004 22:28:13 GMT  
 Adding a control to a tab control

Quote:

> I am having a really rough time trying to add a treecontrol to on of the
> tabs on a tab control. I can do this easily in any language but VC++ because
> it seems like I cant drag and drop the control onto the tab. Is this the
> case. How would I add a tree control to a tab on a tab control. Visually or
> in code. Thanks in advance. An examples or places where I can get good
> examples
> would be appreciated.

> Ryan Taylor


It's not clear what the problem is, but the usual approach is to create
a modeless dialog for each tab page (with titlebar and border styles
off).  Put the control on the modeless dialog.  Put the modeless dialog
on top of the tab control (SetWindowPos) and make only one modeless
dialog visible at a time when the user clicks a tab.

--
Scott McPhillips [VC++ MVP]



Sat, 31 Jan 2004 22:43:25 GMT  
 Adding a control to a tab control

Quote:
> It's not clear what the problem is, but the usual approach is to create
> a modeless dialog for each tab page (with titlebar and border styles
> off).  Put the control on the modeless dialog.  Put the modeless dialog
> on top of the tab control (SetWindowPos) and make only one modeless
> dialog visible at a time when the user clicks a tab.

> --
> Scott McPhillips [VC++ MVP]

The problem is in VB, DEPLHI, and BUILDER, controls can be dragged and
dropped onto a tab control in order to avoid unneccesary coding for the
programmer. I havent been able to find a way to do this in VC++ 6.0.  And I
have found any code examples of how to do it otherwise. I am a VC++ 6.0
newbie. Any examples would be very helpful.

Thanks again.

REWT



Sat, 31 Jan 2004 22:53:28 GMT  
 Adding a control to a tab control
I think you got your answer. The underlying common control is not
what you see in those environments - they add the pages Scott
mentioned for you. In raw VC++ you have to work with the raw
control, hence you have to provide the tab pages yourself...

As an alternative, you can use the OCX version of the tab control
which is the one to provide the tab pages. The original common
control is not a control container (to put it in VB terms).

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD

MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================


Quote:
> > It's not clear what the problem is, but the usual approach is to create
> > a modeless dialog for each tab page (with titlebar and border styles
> > off).  Put the control on the modeless dialog.  Put the modeless dialog
> > on top of the tab control (SetWindowPos) and make only one modeless
> > dialog visible at a time when the user clicks a tab.

> > --
> > Scott McPhillips [VC++ MVP]

> The problem is in VB, DEPLHI, and BUILDER, controls can be dragged and
> dropped onto a tab control in order to avoid unneccesary coding for the
> programmer. I havent been able to find a way to do this in VC++ 6.0.  And
I
> have found any code examples of how to do it otherwise. I am a VC++ 6.0
> newbie. Any examples would be very helpful.

> Thanks again.

> REWT



Sun, 01 Feb 2004 02:34:48 GMT  
 Adding a control to a tab control

Quote:

> The problem is in VB, DEPLHI, and BUILDER, controls can be dragged and
> dropped onto a tab control in order to avoid unneccesary coding for the
> programmer. I havent been able to find a way to do this in VC++ 6.0.  And I
> have found any code examples of how to do it otherwise. I am a VC++ 6.0
> newbie. Any examples would be very helpful.

> Thanks again.

I guess you're not using MFC.  In MFC the CPropertyPage and
CPropertySheet classes do all this for you.  If you are used to and want
the higher-level libraries then consider using MFC.  It's got the most
classes and IDE support and code samples of any of the development
options available in VC.

--
Scott McPhillips [VC++ MVP]



Sun, 01 Feb 2004 03:13:40 GMT  
 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!



Sun, 01 Feb 2004 07:32:52 GMT  
 Adding a control to a tab control
Very Cool. Thanks man.

REWT


Quote:
> 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!



Sun, 01 Feb 2004 21:25:43 GMT  
 Adding a control to a tab control
You'll get this support if you are using property pages without MFC
too. The original poster seems to be using the raw tab control
outside of the context of property pages.

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD

MVP VC FAQ: http://www.mvps.org/vcfaq
=====================================


Quote:

> > The problem is in VB, DEPLHI, and BUILDER, controls can be dragged and
> > dropped onto a tab control in order to avoid unneccesary coding for the
> > programmer. I havent been able to find a way to do this in VC++ 6.0.
And I
> > have found any code examples of how to do it otherwise. I am a VC++ 6.0
> > newbie. Any examples would be very helpful.

> > Thanks again.

> I guess you're not using MFC.  In MFC the CPropertyPage and
> CPropertySheet classes do all this for you.  If you are used to and want
> the higher-level libraries then consider using MFC.  It's got the most
> classes and IDE support and code samples of any of the development
> options available in VC.

> --
> Scott McPhillips [VC++ MVP]



Mon, 02 Feb 2004 06:27:47 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Adding a control to a tab control

2. Adding a control to a tab control

3. How to Add My own Property Tab in the PropertyGrid for Button Control

4. adding controls to tab pages

5. Adding things to Tab Controls

6. Adding dialogs using Tab Control (CTabCtrl)

7. How to Add a tabbed control to CFormView???

8. Newbie->How to add Tabbed control to child window

9. Newbie->How to add Tabbed control to child window

10. How to add controls in TAB?

11. How to Add a tabbed control to CFormView???

12. Tab Control With RichText Control

 

 
Powered by phpBB® Forum Software