Creating Dialog Boxes within a CTabCtrl

Started by
3 comments, last by Carradine 21 years, 7 months ago
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.

--------------------------Vantage: Greenlit on Steam / Independent Games Festival Submission http://www.crystaldragon.com

Advertisement
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
Goblineye EntertainmentThe road to success is always under construction
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.

--------------------------Vantage: Greenlit on Steam / Independent Games Festival Submission http://www.crystaldragon.com

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
Goblineye EntertainmentThe road to success is always under construction
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

This topic is closed to new replies.

Advertisement