Chapter 16: Text-Based Controls Visual C++ and MFC Fundamentals
public:
CEmplAppSheet(UINT nIDCaption, CWnd* pParentWnd = NULL, UINT
iSelectPage = 0);
// CEmplAppSheet(LPCTSTR pszCaption, CWnd* pParentWnd = NULL, UINT
iSelectPage = 0);
virtual ~CEmplAppSheet();
protected:
DECLARE_MESSAGE_MAP()
public:
CPersonalInfo PersInfo;
CEducExperience EducExp;
CEmplSurvey Survey;
};
- Use the constructor to add each page:
CEmplAppSheet::CEmplAppSheet(UINT nIDCaption, CWnd* pParentWnd, UINT
iSelectPage)
:CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
{
AddPage(&PersInfo);
AddPage(&EducExp);
AddPage(&Survey);
}
- To start the wizard when the user clicks OK on the property sheet, we wil laccess the
OnOK() event of the CCompanyForms class.
If you are using MSVC 6, display the ClassWizard. In the Class Name combo box
and in the Object IDs list, select CCompanyForms. In the Messages list, double-click
WM_OnOK
If you are using MSVC 7, in the Class View, click CCompanyForms. In the
Properties window, click the Overrides button. In the OnOK combo box, select
the only item in the list
- Implement it as follows (in reality, the wizard should be displayed based on an item
the user had selected in a property page but we have not covered any of the
necessary controls that would be used to apply such a behavior):
// CompanyForms.cpp : implementation file
//
#include "stdafx.h"
#include "Associates.h"
#include "CompanyForms.h"
#include "EmplAppSheet.h"
...
void CCompanyForms::OnOK()
{
// TODO: Add your specialized code here and/or call the base class
CEmplAppSheet EmplSheet(AFX_IDS_APP_TITLE);
EmplSheet.SetWizardMode();
EmplSheet.DoModal();
CPropertyPage::OnOK();