[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

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

Tab Control

I am trying to develop a dialog based application in MFC (Visual C++ .NET). Everything was going okay until I tried to add TAB control to it. The TAB control works fine but none of the extra dialog boxes created for the application can be seen in it.

I have downloaded the example from

http://www.codeproject.com/dialog/embedded_dialog.asp 

and it compiled fine but whenever I try to create my own tab in the project it doesn’t seen to work.

I have downloaded many other sample programs using tab control and have the same problem when I add my own tab.

I open a new dialog box of ‘IDD_PROPPAGE_MEDIUM’ and add a class of ‘Cpropertypage’ to it. This creates a .h and .cpp file for me. The Header file looks completely different to ones created in the examples. ie there is no

#ifndef __DIALOG2_H
#define __DIALOG2_H

I get a very basic file with #pragma once.

If anyone could help I would really appreciate it as it’s driving me mad. I can let you have the source files if needed.
0
stevekelly
Asked:
stevekelly
  • 2
  • 2
2 Solutions
 
AlexFMCommented:
0
 
Karl Heinz KremerCommented:
The CPropertyPage is a separate dialog, it was not inteded to be used on another dialog. The usual way to get a property sheet embedded on a dialog is to create a place holder frame (usually a non-visible, disabled picture control) on the dialog. In the OnInitDialog() method of the dialog you then create the property sheet, and you get the position and size of the placeholder frame. Then you move the CTabCtrl of the property sheet to the position of the placeholder. It's not as simple as adding other controls to your dialog.
You have to study the sample program and mimic what it is doing in your program.

The link posted by AlexFM uses a CTabCtrl derived class, but you have to use this custom class (The CMyTabCtrl).

You can also use a CTabCtrl directly, and still get the same behavior.
0
 
Karl Heinz KremerCommented:
Split between AlexFM and khkremer
0
 
AlexFMCommented:
Agree.
0

Featured Post

Technology Partners: 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!

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