Solved

Tab Control and Multiple Dialogs

Posted on 2000-03-19
8
240 Views
Last Modified: 2013-11-20
I have a resource called MainDlg described by CMainDlg class and also Dlg1, Dlg2, Dlg3 resources described by CDlg1, CDlg2, CDlg3 classes, accordingly.

On MainDlg I placed a Tab Control which I then (in the program) initialized with 3 tabs that are supposed to display the three secondary dialogs.

The question is: what code in the function processing the Tab Control left-click message (or whatever) I should use if I want to build something like the Property Pages without directly using the CPropertyPage (or however it is called)?

In other words, how can I link a tab from the tab control with a child window to display? Or should I use a different method altogether?

The reason I don't want to use the predefined class of Property Pages is that it doesn't allow to manage the buttons (Ok, Cancel, Apply, Help) on its bottom, and I don't need them there.
0
Comment
Question by:Lescha
  • 4
  • 4
8 Comments
 
LVL 10

Expert Comment

by:RONSLOW
ID: 2634644
Property pages do let you control the buttons at the bottom.  For example, you can turn them on or off, movethem around, add other ones etc.

if you still don't wnat to use them and prefer to roll-your-own instead, respond to:

ON_NOTIFY(TCN_SELCHANGE, IDC_XXX, OnSelchangeXXX)

within the handler do something like
  int tabselected = m_xxx.GetCurSel();
where m_xxx is a CTabCtrl you've associated with the tab control (or you can use GetDlgItem if you prefer).


0
 
LVL 1

Author Comment

by:Lescha
ID: 2636691
No, no, I know _how_ to respond to the clicks. What I am asking is how do I display a different bunch of controls for every page?

Do I have to create them during the run-time? If so, they must have predefined classes. Not good. If not, how can I use a predefined dialog?
0
 
LVL 10

Accepted Solution

by:
RONSLOW earned 50 total points
ID: 2638139
Use child dialogs and

Look at the MS KB article and sample

SAMPLE: Property Sheet as the View Window of a CFrameWnd
ID: Q161886

Despite the title, it shows how to use your own tab control and child dialogs (rather than use CPropertySheet).

The SDK documenation has a section on "Tab Control" where it also shows code for how to create a tab control with child dialogs etc.


0
 
LVL 1

Author Comment

by:Lescha
ID: 2678026
Oh, drat! You mean, there is no control in MFC parallel to PageControl in Delphi? And all other derivatives from the idea of the tabs? Niet? :-(
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 10

Expert Comment

by:RONSLOW
ID: 2678482
This is not MFC so much, as windows.

A tab control is simply a control that has some tabs and for which you can handle clicks.  It is very much like a set of radio buttons in that respect.

The smarts are in how you respond to the clicks on tabs.  It could just change the way some control display data, or make some control appear/disappear, or display child dialogs etc.  It is all up to the programmer.

Windows does provide a property page / sheet that uses a tab-control.  You can embedd that within a dialog and it will manage the pages and child dialogs etc.  When you embed it in another dialog, you don't get the OK/Cancel buttons etc.  You can provide your own ones.

That is probably closest to the page control thing you talk about in Delphi (never seen it so I can only guess).  And would be the best solution (I think) for your problem.  I can point you to sample code that shows how to do this, if you like.


0
 
LVL 1

Author Comment

by:Lescha
ID: 2684249
Yes, I'd appreciate that. I tried the PropertyPage before, but as a stand-alone resourse, and couldn't get rid of the annoying buttons.
0
 
LVL 10

Expert Comment

by:RONSLOW
ID: 2757689
best place is to go to http://www.codeguru.com

Property Sheet + Property Page will have the buttons unless you make it modeless or put it in a dialog as a child.

There are plenty of examples at the codeguru site that will show you a lot of possible solutions.  Pick the one that you unserstand the best and best suits your requirements.
0
 
LVL 1

Author Comment

by:Lescha
ID: 2758009
Thanks, I'll take a look. I knew about that site, but never took time to dug deeply.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Mac OS 9 (Classic Environment) vs. MacBook Pro OS 10 8 36
lucky13 challenge 11 112
fizzArray  challenge 1 47
mapBully challenge 6 89
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: 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…
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.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

706 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

18 Experts available now in Live!

Get 1:1 Help Now