Solved

Tab Control and Multiple Dialogs

Posted on 2000-03-19
8
251 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 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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
Named range not carried over 10 71
sumHeights  challenge 17 83
Change to event 1 136
Excel file not created as expected 7 110
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 …
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Suggested Courses

734 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