Adding the XML Element for the Wizard

An extension can contain any number of wizards. For each wizard that you want to create, you add the element <wizard> in the extension's XML file. For each wizard, you define steps. For each step, you define callbacks and properties.


Tip:  To customize the appearance of a Workbench-based wizard, you can add the optional element <uidefinition>. In this element, you can define layouts both for the wizard interface as a whole and for individual wizard components. For more information, see Custom Wizard Interfaces and Custom Wizard Interface Example.


The extension WizardDemos contains a project wizard named ProjectWizard that is executed from the Project tab in Workbench. An excerpt from the file WizardDemos.xml follows. Code is omitted for the element <uidefinition> and all wizards other than the wizard ProjectWizard.

<extension version="2" minorversion="1" name="WizardDemos">
	<guid shortid="WizardDemos">7fdb141e-3383-433a-a5af-32cb19971771</guid>
	<author>Ansys, Inc.</author>
	<description>Simple extension to test wizards in different contexts.</description>

	<script src="main.py" />
	<script src="ds.py" />
	<script src="dm.py" />
	<script src="sc.py" />
	
	<interface context="Project|Mechanical|SpaceClaim">
		<images>images</images>		
	</interface>
	
	<interface context="DesignModeler">
		<images>images</images>		
		
		<toolbar name="Deck" caption="Deck">
			<entry name="Deck" icon="deck">
				<callbacks>
					<onclick>CreateDeck</onclick>
				</callbacks>
			</entry>
			<entry name="Support" icon="Support">
				<callbacks>
					<onclick>CreateSupport</onclick>
				</callbacks>
			</entry>
		</toolbar>
	
	</interface>
	
	... 
	
	<wizard name="ProjectWizard" version="1" context="Project" icon="wizard_icon">
		<description>Simple wizard for demonstration in Project page.</description>
		
		<step name="Geometry" caption="Geometry" version="1" HelpFile="help/geometry.html" layout="DefaultTabularDataLayout">
			<description>Create a geometry component.</description>
			
			<componentStyle component="Submit">
				<background-color>#b6d7a8</background-color>
			</componentStyle>

			<componentData component="TabularData">
				<CanAddDelete>false</CanAddDelete>
			</componentData>

			<callbacks>
				<onupdate>EmptyAction</onupdate>
				<onreset>DeleteGeometry</onreset>
				<oninit>InitTabularData</oninit>
			</callbacks>
			
			<propertygroup display="caption" name="definition" caption="Basic properties" >
				<property name="filename" caption="Geometry file name" control="fileopen" />
				<property name="myint" caption="Integer value" control="integer" />
				<property name="mytext" caption="Text value" control="text" />
				<property name="myquantity" caption="Quantity value" control="float" unit="Pressure" />
				<property name="myreadonly" caption="Readonly value" control="text" readonly="true" default="My value" />
				<propertygroup display="property" name="myselect" caption="List of choice" control="select" default="Option1">
					<attributes options="Option1,Option2" />
					<property name="option1" caption="Option1 value" control="text" visibleon="Option1" />
					<property name="option2first" caption="Option2 first value" control="float" unit="Pressure" visibleon="Option2" />
					<property name="option2seond" caption="Option2 second value" control="float" unit="Length" visibleon="Option2" />
				</propertygroup>
			</propertygroup>

			<propertytable name="Table" caption="Table" control="custom" display="worksheet" class="Worksheet.TabularDataEditor.TabularDataEditor">
				<property name="Frequency" caption="Frequency" unit="Frequency" control="float" isparameter="true"></property>
				<property name="Damping" caption="Damping" control="float" isparameter="true"></property>
				<property name="TestFileopen" caption="fileopen" control="fileopen"></property>
			</propertytable>

			<propertytable name="TableB" caption="Table B" control="tabulardata" display="worksheet">
				<property name="Integer" caption="Integer" control="integer"></property>
				<property name="FileOpen" caption="Fileopen" control="fileopen"></property>
				<property name="Number" caption="Number A" unit="Pressure" control="float"></property>
				<property name="ReadOnly" caption="ReadOnly" unit="Pressure" control="float" readonly="true" default="4 [Pa]"/>
				<propertygroup display="property" name="myselect" caption="List of choice" control="select" default="Option1">
					<attributes options="Option1,Option2" />
					<property name="TestStr" caption="Text" control="text" visibleon="Option1"></property>
					<property name="Number B" caption="Number B" unit="Temperature" control="float"></property>
				</propertygroup>
			</propertytable>

		</step>

		<step name="Mechanical" caption="Mechanical" enabled="true" version="1" HelpFile="help/mechanical.html">
			<description>Create a mechanical component.</description>
			
			<callbacks>
				<onupdate>EmptyAction</onupdate>
				<onreset>DeleteMechanical</onreset>
			</callbacks>
			
			<property name="name" caption="System name" control="text" />
			
		</step>	
		
		<step name="Fluent" caption="Fluent" version="1" HelpFile="help/fluent.html">
			<description>Create a fluent component.</description>
			
			<callbacks>
				<onrefresh>CreateDialog</onrefresh>
				<onupdate>EmptyAction</onupdate>
				<onreset>EmptyReset</onreset>
			</callbacks>
			
			
			<property name="name" caption="System name" control="text" />
			<property name="dialog" caption="Dialog" control="text">
				<callbacks>
					<onvalidate>ValidateDialog</onvalidate>
				</callbacks>
			</property>
			<property name="dialog2" caption="DialogProgress" control="text">
				<callbacks>
					<onvalidate>ValidateDialogProgress</onvalidate>
				</callbacks>
			</property>
			<property name="nextstep" caption="Next Step" control="select" >
				<callbacks>
					<onvalidate>ValidateNextStep</onvalidate>
				</callbacks>
			</property>
			
		</step>	
		
		<step name="ReportView" caption="ReportView" version="1" layout="ReportView@WizardDemos">
			<description>Simple example to demonstrate how report can be displayed.</description>
			
			<callbacks>
				<onrefresh>RefreshReport</onrefresh>
				<onreset>EmptyReset</onreset>
			</callbacks>
			
		</step>	
		
		<step name="CustomStep" caption="CustomStep" enabled="true" version="1" layout="MyLayout@WizardDemos">
			<description>Create a mechanical component.</description>
			
			<callbacks>
				<onrefresh>RefreshMechanical</onrefresh>
				<onupdate>LogReport</onupdate>
				<onreset>EmptyReset</onreset>
			</callbacks>
			
			<property name="name" caption="System name" control="text" />
			
		</step>	
		
		<step name="Charts" caption="Charts" enabled="true" version="1" layout="GraphLayout@WizardDemos">
			<description>Demonstrate all chart capabilities.</description>
			
			<callbacks>
				<onrefresh>RefreshCharts</onrefresh>
			</callbacks>
			
		</step>	
		
	</wizard>

	... 
		
</extension>

As indicated in the element <description>, this extension is for testing wizards in different contexts. It has two elements <interface>. In the first element <interface>, the attribute context is set to Project|Mechanical|SpaceClaim, which indicates that wizards with their context set to these products use this interface. In the second element <interface>, the attribute context is set to DesignModeler, which indicates that wizards with their context set to this product use this interface.

In addition to the project wizard named ProjectWizard, the extension WizardDemos includes target product wizards for DesignModeler, SpaceClaim, and Mechanical. Additionally, it includes a mixed wizard. For information on the product-specific wizards in this extension, see the ACT customization guides for these products. The concluding section provides links to these guides.