Archived

This topic is now archived and is closed to further replies.

Creating Dialog Boxes within a CTabCtrl

This topic is 5592 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am attempting to make a CTabCtrl object inside of another dialog box. It has 3 ''tabs'' and I want to display a different dialog box for each of the three tabs. I was wondering if there was a simple way to do this, none of the MFC examples show this directly. I also was trying to determine if I should use CPropertySheet instead. The MFC examples show how to use that, but it seems like it is used more for its own window instead of inside of another dialog box, which putting this into a dialog box is the result I am looking for. Thanks for any help.

Share this post


Link to post
Share on other sites
I''m not using MFC, but what you''re describing is pretty easy to implement (There are some code samples about it at the MSDN).
You will need to create the dialog box (CreateDialog(); ) as a child window, then you should get the RECT of the tab control and SetWindowPos() the dialog box to fit it inside the tab control.


Goblineye Entertainment
The road to success is always under construction

Share this post


Link to post
Share on other sites
That sounds about right. But I was trying to figure out whther CTabCtrl dialog box had a way to just add another dialog box into each tab autromatically, like how CPropertySheet just has the AddPAge() function, and the rest is taken care of. For now I am assuming my option with CTabCtrl is just just size it on my own, and create a 3 dialog boxes. When a Tab is changed by the user, i just need to hide 1 dialog box and show another. That is fone for me, but I was just making sure that is the simplest way.

Share this post


Link to post
Share on other sites
If you want stuff automatically done for you, property sheets is the way to go.
But, you can emulate a property sheet using a tab control and having several dialog boxes that act as child windows (Just like you described).
I personally use tab controls for this because I wanted it to have the look of a property sheet, but it also had work on all OS''s (Some features of property sheets only work on 98+/2k+).


Goblineye Entertainment
The road to success is always under construction

Share this post


Link to post
Share on other sites
CPropertySheet is in a dialog of its own which you can alter and change - like getting rid of the ok, cancel and apply button. This has to be done programmatically though.

If you have other controls on your dialog in conjuction with the tab control, then using a plain dialog box with the tab control would be easier.

Also, if you ever get the LoadBitmap of a CStatic to work with TabCtrl then tell me

Share this post


Link to post
Share on other sites