Alternative Wizard Dialog
Posted
by Iuri Apollonio
on August 7th, 1998
Download demo 141K

1. Using this dialog
This is a simple demo for a "wizard-like" dialog; it shows how you can handle child dialogs.It's use is simple. Here are the steps you need:
- create the dialog pages for the wizard controls using dialogs without title, border, system menu, with the "visible" flag turn off and the "control" and "control parent" flags turn on.
- create the dialog classes for these sheets
- to invoke the wizard dialog, do something like this:
CWizardDlg dlg; dlg.csTitle = "This is a test wizard"; CTestPage1 page1; CTestPage2 page2; CTestPage3 page3; dlg.AddPage("Page 1\tsmall description of step 1", &page1, CTestPage1::IDD); dlg.AddPage("Page 2\tsmall description of step 2", &page2, CTestPage2::IDD); dlg.AddPage("Page 3\tsmall description of step 3", &page3, CTestPage3::IDD); dlg.DoModal();The dlg.csTitle will specify the title of the wizard dialog.
The parameters for the AddPage function are this:
- name and description, separated by a \t caracther
- pointer to the page dialog
- the page dialog ID
In the demo, I putted a sample for the normal CWizardDlg and one for a derived one. In the derived one we take an integer from an edit control in page2 and insert it*2 in an edit on page 3.
A derived class can be like this:
class CCustomWizardDlg : public CWizardDlg
{
public:
virtual void SetCurSel(const int idx);
};
void CCustomWizardDlg::SetCurSel(const int idx)
{
CWizardDlg::SetCurSel(idx);
if (idx == 2)
{
CTestPage2 * p2 = (CTestPage2 *) GetDialog(1);
CTestPage3 * p3 = (CTestPage3 *) GetDialog(2);
p3->iTestInt = p2->iTestInt * 2;
p3->UpdateData(false);
}
}
The text resource for buttons (back, next, cancel, end) are stored as define and not as string resource. You can find them at beginning of wizarddlg.cpp file.
2. What do I need to use the dialog ?
You'll have to add/insert as components the CNetButton and the CWizardDlg classes.You'll also have to provide a bitmap to be used and set it in the IDD_WIZARDBASE dialog template.
The dialogs page will be automatically fitted into the frame in the IDD_WIZARDBASE dialog; resize this frame to accomplish the desired size.
Last updated: 28 June 1998

Comments
How to do same things, but without MDI?
Posted by Legacy on 10/18/2001 12:00amOriginally posted by: Maximus
ReplyWizardwindow
Posted by Legacy on 10/16/2001 12:00amOriginally posted by: Rajat BAl
I need sample but in this tips are not enough to understand the topic
ReplyExcellent.
Posted by Legacy on 09/20/1999 12:00amOriginally posted by: Aykut KILIC
Almost all useful articles I see here has the signature of Apolloni.
ReplyThanks to You.
Need help finishing up the wizard!
Posted by Legacy on 06/11/1999 12:00amOriginally posted by: Curtis
Your wizard is pretty good and I am finding it very useful, however, I have added all the pages I need, and have many variables set from all the different pages. Now what I would like to do is to take all those variables and use them when the user presses the "End" or "Finish" button on the wizard. How do I detect when the "End" button has been pressed? I need to do this from the View class of my application as well, because I am going to be using the variables to draw some things on the screen. Any help you could provide would be greatly appreciated!
Thanks,
ReplyCurtis