Documentation for the Wizard Template

The Wizard Template consists of two objects.  The base wizard window, w_wizardmater, and the base wizard step, u_wizardstepmaster.  These objects work in combination to form the wizard template.  In order to create a wizard you must first create the steps.  To create a step, simply create a user object inherited from u_wizardstepmaster.  Once you have created all of your steps you must create the wizard window.  To create the wizard window, simply create a window inherited from w_wizardmaster.  In the wizard window's PFC_PREOPEN event, you must register each step with the wizard.  To register each step just call of_addstep(), passing the class name of the step you are adding.  At this point you should be able to test your wizard and see its visual presentation.  In order to pass data through your wizard you must create an attribute object.  Create a nonvisual object inherited from the PFC's n_cst_baseattrib.  Then in the wizard window's PFC_PREOPEN event, register the attribute object by calling of_setattribobject().  This object will be passed as an argument (by reference) to all of the steps navigational events, i.e. wizardstep_predraw, wizardstep_postdraw and wizardstep_prenavigate.  For more information please refer to the tables below and the example application included.

 w_wizardmaster

Functions

Arguments

Description

of_AddStep String      Class name of the step Add a steps to the end of the wizard.
of_DeleteStep Integer      Number of the step to delete Removes a step.
of_InsertStep Integer      Insert before this step number

String     Class name of the step

Inserts a step.
of_SetAttribObject n_cst_baseattrib     Attribute object for the wizard Registers an object to be passed to each steps navigational events.  This object is intended to hold the data collected by the wizard.
of_GetAttribObject (None) Returns the object registered with of_SetAttribObject().

Events

Arguments

Description

wizard_finish (None) This event is triggered when a user clicks the ‘Finish’ button (after the pre-navigation events are triggered).
wizard_postnavigate String     WIZARD_NEXT, WIZARD_BACK, WIZARD_FINISH This event is triggered after a new step is opened.  You may extend this event.
wizard_prenavigate String     WIZARD_NEXT, WIZARD_BACK, WIZARD_FINISH This event is triggered before a new step is opened. You may extend this event.

u_wizardstepmaster

Events

Arguments

Description

wizardstep_postdraw n_cst_baseattrib     The wizard's attribute object registered with of_SetAttribObject().  Passed by reference. This event is triggered after the step is opened and drawn on the window. Extend this event to add an code you wish to execute after the user sees the new step. For example, initiate a datawindow retrieve.
wizardstep_predraw n_cst_baseattrib     The wizard's attribute object registered with of_SetAttribObject().  Passed by reference. This event is triggered after the step is opened but before it is drawn on the window. This event is intended for you to set initial or saved values for controls on your step.
wizardstep_prenavigate n_cst_baseattrib     The wizard's attribute object registered with of_SetAttribObject().  Passed by reference.

String     WIZARD_NEXT, WIZARD_BACK, WIZARD_FINISH

This event is triggered before a new step is opened. Extend this event to add your step validation logic. You may prevent the next step from opening by returning the appropriate value.

Wizard97 Style

You may have noticed that some of the wizards in newer Microsoft products look different.  Those wizards are based on the Wizard97 specification.  You can create the same kind of wizards using the Wizard97 template steps.  The Wizard97 specifications are available from the Microsoft Developers Network (MSDN).  Those specifications describe three types of steps within a wizard:  a welcome step, interior steps, and a completion step.  Welcome and completions steps should be inherited from the new step template:   u_wizardstep_97exterior.  All other interior steps should be inherited from u_wizardstep_97interior.  You also need to call of_setWizard97style(TRUE) in the wizard window's PFC_PREOPEN event.

Frequently Asked Question

How are a wizard's size and dimensions determined?

The wizard dynamically resizes itself around the dimensions of your first registered step.  So to change the size and dimensions of your wizard, just change the size and dimensions of your first step.

How can I use a wizard to collect data and return it to the calling script?

This is very easily accomplished.  First create an attribute object by inheriting from n_cst_baseattrib.  Declare, and if necessary instantiate, that attribute object in your calling script.  Open the wizard by calling OpenWithParm(w_yourwizardhere,lnv_yourattribobjecthere).  Now in the PFC_PREOPEN event, call of_SetAttribObject(message.PowerObjectParm).  Save and collect the data in your wizard step's events.  Then, if your attribute object was NOT autoinstantiate, after the wizard is closed the calling script's lnv_yourattribobject will reflect the data you collect in the wizard.  If you attrib object WAS autoinstantiate, then in the wizard_finish event call CloseWithReturn(this,this.of_GetAttribObject()) and in the calling script lnv_yourattribobjecthere = message.PowerObjectParm.

How can I put a picture on a wizard?

Place a picture control on your wizard's window.  This picture control will appear on top of each step, so just make sure you leave the area in your steps where the picture will appear empty.