The custom wizard page in the example is defined in the LocationPage.cpp file. Wizard pages are derived from template classes that provide much of the functionality a page has. All wizard pages should derive from the WizardPageImpl template class, which implements the IWizardPage interface. Each wizard page can implement other optional template classes and corresponding interfaces based on the needs of the page.

The WizardPageImpl template class has several useful interfaces that can help you write custom wizard pages. Implement the WizardPageImpl template class as the base class for your custom wizard page.

For a list of the available:

·     Template classes for wizard pages, see Wizard Page Helper Classes

·     Interfaces for the wizard page template classes, see Wizard Page Interfaces

The custom wizard page in the example is derived from the WizardPageImpl template class and implements the IWizardPage interface. In addition, the custom wizard page implements the IFieldCallback interface. Both of these are implemented in the LocationPage.cpp file.

The example custom wizard page overrides the following methods:

·     OnWindowCreated. The OnWindowCreated method in the example wizard page calls the following methods:

·     AddField. This method relates the IDC_COMBO_LOCATION box control in the IDD_LOCATION_PAGE resource with the Data element named Location in the Config.xml file.

In addition to the AddField method, you could use the AddRadioGroup and AddToGroup methods to support other controls and behaviors.

Note   Ensure that you call the AddField, AddRadioGroup, or AddToGroup method prior to calling the InitFields method.

·     InitFields. Use this method to initialize the fields (controls) that you have added to the form. The pointer of the page is a parameter. In the example, the this pointer is passed, which refers to the current page.

Note   To support the use of the this pointer, you must implement the IFieldCallback interface in addition to the interfaces that the WizardPageImpl template class supports.

The IFieldCallback interface calls the SetFieldDefault method, which is used to set the default values for controls other than text box and check box controls. In the example, the SetFieldDefault method sets the initial index of the combo box control based on the default value specified in the Default element for the Field element in the Config.xml file.

The OnWindowCreated method sets up the form controller using the IFormController interface. For more information about setting up the form controller, see Setting Up the Form.

·     InitLocations. This method populates the combo box from the list of locations in the Config.xml file. The Data element and child DataItem elements the Confg.xml file provide the list of possible values.

·     OnNextClicked. This method performs the following tasks:

·     Updates the TSLocation task sequence variable with the value selected in the combo box using the SaveFields method

·     Adds information that will be shown on the Summary page using the SaveFields method

Related Topics

Review the SamplePage Example