?
Solved

Tab Control and Multiple Dialogs

Posted on 2000-03-19
8
Medium Priority
?
262 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
[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
  • 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 150 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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
 
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

Get MongoDB database support online, now!

At Percona’s web store you can order your MongoDB database support needs in minutes. No hassles, no fuss, just pick and click. Pay online with a credit card. Handle your MongoDB database support now!

Question has a verified solution.

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

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
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.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

764 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