Branching [Switch]
More useful than simple skipping is to present the user with a set of choices, and to branch the flow as requested. The WizardEngine provides a method named, "Switch" for this purpose. The parameters to "Switch" are:
- Labels: An array of labels for the radio buttons.
- Bmps: An array of image values for the icons (32*32 images).
- Descriptions: An array of descriptions (up to four lines of text can be accommodated).
- Destinations: An array of state names.
- DefaultVal: An optional parameter that is the value (0..2) of the initial selection.
- BottomMargin: An optional parameter specifying the padding at the bottom of the wizard.
- EnableFlags: Arrays of TRUE/FALSE flags to determine which radio buttons are enabled/disabled.
- ToolTips: Phrase labels to display in the tooltips for the individual radio buttons
A maximum of five choices can be accommodated. Assuming that suitable variables were declared and initialized:
Tasks = New(3);
TaskDescs = New(3);
TaskBmps = New(3);
TaskSwitch = New(3);
Tasks[0] = "Choice 1";
Tasks[1] = "Choice 2";
Tasks[2] = "Choice 3";
TaskBmps[0] = MakeBitmap(FileFind("C:\VTScada\Resources\Copy.png", 0))
TaskBmps[1] = MakeBitmap(FileFind("C:\VTScada\Resources\Cut.png", 0))
TaskBmps[2] = MakeBitmap(FileFind("C:\VTScada\Resources\Paste.png", 0))
TaskDescs[0] = "Selecting this will take you down path number one.";
TaskDescs[1] = "Selecting this will take you down path number two.";
TaskDescs[2] = "Selecting this will take you down path number three.";
TaskSwitch[0] = "Switch1";
TaskSwitch[1] = "Switch2";
TaskSwitch[2] = "Switch3";
Then the state for the branch might appear as follows:
SelectTask [
WTitle = "Select Required Task";
Task = Engine\Switch(Tasks, TaskBmps, TaskDescs, TaskSwitch, SvTask);
If Move;
[
SvTask = PickValid(Task, 0);
Move = 0;
ForceState(NextState);
]
]
Example:
"Switch" returns the value (0..2) selected.