Creating Tab ctrl within dialog application

I have a dialog based application that has buttons, edit boxes and static controls on it.  This was all developed through the wizard.  I would also like to place a tab control along with these other controls.  I also used the wizard to place the tab control within the dialog window.

The question is - How do I place controls within the tab control?

I have tied to use the CPropertySheet and CPropertyPage classes, but was not real successful in coordinating these with the tab control that was placed with the wizard.

I have also tried the path without using the CProperty classes.  I was able to create several "tabs" within the tab control, but was not successful with placing other controls (ie, buttons, editbox...) within the tab control.  I am able to trap on the messages (TCN_SELCHANGE) that are used for the tab control.

Can I use the CPropertyPage class (and the wizard) to create the tab "dialog" layout, or do I have to create/position/manage the controls manually for each tab within the tab control?

Thanks for your help,
David Brekke
brekkeAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gelbertCommented:
You have two ways of placing tab control in the dialog.
         First. In esource wizard put Tab control(CTabCtrl) in dialog and all controls which are going to use with this control. Then you have to group all your controls according to pages of tab control where they would be placed. As soon as you catch TCN_SELCHANGE you should display  group of controls accossiated with new page and hide group of controls accossiated with old page.
        Second. Create  number of dialogs to accossiate them with CProperty pages and create CPropertySheet in InitDialog() and attach property pages.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
brekkeAuthor Commented:
Gelbert,

   I have used the class wizard to place controls within the "main" dialog.  This includes CButton, CEdit and CTabCtrl controls.  Then I created (with class wizard) some other dialogs with the CPropertyPage class.  These represent my different tab dialogs within the CTabCtrl control.  I then created a CPropertySheet class.  Added the CPropertyPage dialogs with the AddPage member function.  Now, I have an ID associated with the CTabCtrl (created by class wizard), I have a variable m_MyTabSheet that points to the property sheet and associated added pages.  How do I display the sheet/pages within the CTabCtrl control?  I can't seem to put the two together.

Let me know if you need more information.

Thanks again,
David Brekke
0
brekkeAuthor Commented:
Still having problems.  See comment.

Thanks,
David Brekke
0
gelbertCommented:
sorry it took me too long to read your comments. What you nedd to do is to decide if you are going to use CTabCtrl or CPropertySheet/CPropertyPage. If you use CTabCtrl( this way is better if you want to use class wizard) then do not use CPropertySheet. Just insert in your dialog controls whichyou want to show for each page and hide/show then when user selected new tab. For example: you need tab control with tabs A, B and C. Each tab should have couple controls on it.
So you create dialog place tab control on it and set tab control to have three tabs A, B and C. Also you add to dialog six more controls A1, A2 to be shown on tab A, B1, B2 to be shown on tab B and C1, C2 to be shown on tab C. When user select tab A ( you get TCN_SELCHANGE with index of selected tab ) you hide B1,B2, C! and C2 and display A1 and A2. The same story for any other tab. If you would have problems email sample code for your class to gelbert@mailexcite.com
0
brekkeAuthor Commented:
Gelbert,
   Thanks for getting back to my question.  I had that idea in the back of my mind, but I wasn't sure if there was a better way to accomplish this.  I'm sure glad that you recommended hiding controls, because that was the way that I implemented it.

Thanks again for your help.
David Brekke
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.