Solved

Creating Tab ctrl within dialog application

Posted on 1997-09-18
5
280 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
  • 3
  • 2
5 Comments
 
LVL 8

Accepted Solution

by:
gelbert earned 50 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

707 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now