Sign in to follow this  
rouaiha

WinAPI: Tab Control with Dialogs

Recommended Posts

Hi I'm trying to create a tab control within my dialog. The dialog containing the tab control is created with the dialog editor in visual studio. the data to be shown inside the tab control are also dialogs created the same way (one dialog per tab). I tried the example found in the MSDN but it did not really help me... I couldn't get it to work. I already searched the internet and tried some things... but i don't want to waste too much time on that. So my question: does anyone have a simple example (best would be a working visual studio project) showing how to do what i'm trying to? that would be great! Any tips or different approaches are welcome. What i need is a dialog that contains different control elements plus a tab control. The tabs need to contain different control elements themselves. Thanks in advance! rou

Share this post


Link to post
Share on other sites
It's a bit of work in pure Win32 API (no MFC).

All the tab content dialogs are created as child dialogs, hidden on creation. Make sure to position and resize the child dialogs according to the RECT you can calculate via TCM_ADJUSTRECT.

When you receive the message TCN_SELCHANGE you hide the current dialog and show the new dialog.

Share this post


Link to post
Share on other sites
Ok, I figured it out.

The MSDN example was a bit confusing. It created and destroyed the dialogs all the time and even by copying the code I couldn't get it to run.

I changed some things. Now, as you suggested, I create my dialogs and let them be hidden until a tab is selected. Then I just show the requested dialog. It's so much simpler than the MSDN example makes believe. Another confusing thing was the calculation of the sizes in the example. I also stripped that down to the needed.

Thanks for the help. If anyone else has the same problem and is searching for a solution, mail me at "mail@smronline.de".

rou

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this