?
Solved

Creating Tab ctrl within dialog application

Posted on 1997-09-18
5
Medium Priority
?
289 Views
Last Modified: 2013-11-19
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
0
Comment
Question by:brekke
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 8

Accepted Solution

by:
gelbert earned 100 total points
ID: 1306565
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
 

Author Comment

by:brekke
ID: 1306566
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
 

Author Comment

by:brekke
ID: 1306567
Still having problems.  See comment.

Thanks,
David Brekke
0
 
LVL 8

Expert Comment

by:gelbert
ID: 1306568
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
 

Author Comment

by:brekke
ID: 1306569
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

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month15 days, 2 hours left to enroll

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question