Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 272
  • Last Modified:

Tab Control and Multiple Dialogs

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
Lescha
Asked:
Lescha
  • 4
  • 4
1 Solution
 
RONSLOWCommented:
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
 
LeschaAuthor Commented:
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
 
RONSLOWCommented:
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!

 
LeschaAuthor Commented:
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
 
RONSLOWCommented:
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
 
LeschaAuthor Commented:
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
 
RONSLOWCommented:
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
 
LeschaAuthor Commented:
Thanks, I'll take a look. I knew about that site, but never took time to dug deeply.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now