Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Child Dialog (Sub Forms)

, 17 Nov 1999
A simple class for handling Child Dialogs within a dialog or property sheet.
// TestDlg.cpp: Implementierungsdatei

#include "stdafx.h"
#include "ChildDlgTest.h"
#include "TestDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;

// Dialogfeld CTestDlg 

CTestDlg::CTestDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CTestDlg::IDD, pParent)
		// HINWEIS: Der Klassen-Assistent f�gt hier Elementinitialisierung ein

void CTestDlg::DoDataExchange(CDataExchange* pDX)
	DDX_Control(pDX, IDC_COMBO1, m_Combo);


// Behandlungsroutinen f�r Nachrichten CTestDlg 

BOOL CTestDlg::OnInitDialog() 
	// TODO: Zus�tzliche Initialisierung hier einf�gen


    //#### initialize sub forms
    CRect r;
    (GetDlgItem(IDC_SUBFORM_FRAME))->GetWindowRect(&r); // get the position for the subforms
    //    m_SubForms.SetRelPos(r);  // if the positioning is absolute
    m_SubForms.SetCenterPos(r);     // if the subdialog needs to be centered
    m_SubForms.CreateSubForm(IDD_SUBFORM1,this); // create the sub forms
    m_SubForms.ShowSubForm(); // show the first one
    //#### end initialize sub forms

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zur�ckgeben

void CTestDlg::OnShowWindow(BOOL bShow, UINT nStatus) 
	CDialog::OnShowWindow(bShow, nStatus);
    // TODO: Code f�r die Behandlungsroutine f�r Nachrichten hier einf�gen

void CTestDlg::OnSelchangeCombo1() 
    //#### method to change between sub forms
    //#### here a combobox in the main dialog is used

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Daniel Zuppinger
Chief Technology Officer
Switzerland Switzerland
Professional IT developer since 1983. First projects with Cobol, then Pascal, Modula2, C and since Visual C++ 1.0 also with C++. Works since 1986 as Consultant, between 1990 and 2008 for Infobrain in Switzerland, currently employed by enValue (also Switzerland).
Current field is the project management and development of software for Bank applications.
Married, two daughters, Hobbies : Paragliding, Orienteering, Mountainbiking, Photography

| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.141223.1 | Last Updated 18 Nov 1999
Article Copyright 1999 by Daniel Zuppinger
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid