Solved

Creating Tab ctrl within dialog application

Posted on 1997-09-18
5
286 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 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
function returning CString in a regular win32 DLL 8 215
Folder Comparison 12 55
if loop in java 3 174
scoreUp challenge 14 72
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
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.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Suggested Courses

739 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