Basic Wizard Engine Interface

The Wizard Engine takes the following parameters:

      WizardName: A text value indicating the name for this particular Wizard.

      WizBmp: A bitmap value of a graphic that will be displayed at the first and last steps of the Wizard (see the notes below for sizing information).

      pState: A pointer to a variable that is set by the WizardEngine to the name of the next state that the Wizard should execute.

      pMove: A pointer to a variable set by the WizardEngine as a trigger when the Wizard is required to change states. The actual value of the trigger provides further information, if required, about the direction of movement, and so forth.

      pCancel: A pointer to a variable that the Wizard sets to the title that is to be displayed on the current step.

      LogoBmp: A bitmap value of a graphic that will be displayed at the RHS of the header bar. If Invalid, LogoBmp defaults to \DispMgrBitmap.

      AppName: A text value that will be displayed as the initial title and at the bottom left of other screens. If Invalid, defaults to \LibX\AppName.

The Wizard has to launch a copy of the WizardEngine on entry to its first state; typically:

Init [
  If !Valid(Engine); 
    [ 
      Root = Self();
      Engine = Launch(Scope(\Code, "WizardEngine"), Self, Self,
                  GetDefaultValue(FindVariable("Title", Self, 0, 1)),
               MakeBitmap(\LibX\FindFile("Resources\Wizard.jpg", 0)),
               &nextState,
               &Move,
               &Cancel,
               &WTitle);
    ] 

WTitle = "This wizard will help you to add a new Operator to this " + CRLF +
  "IntelliWell system." + CRLF + CRLF + CRLF + CRLF +
  "Press NEXT to continue";
    If Move;
    [
          Move = 0; 
          ForceState(NextState); 
    ]
]

The sample code above, running in a page titled "Operator Wizard", in an application named, "IntelliWell", produces the result below.

With regards to the image above:

      The bitmap is scaled so that its height fits the vertical space between the title bar and the bottom bar. The aspect ratio then determines the positioning of the RH panel. To avoid distortion, it is best to size the bitmap exactly. The bottom bar is 40 pixels high.

      The large title "IntelliWell" comes from the "AppName" parameter.

      In this instance, the "WizardName" parameter is "Operator Wizard" (obtained from the DisplayManager page name), and this string is used in the window caption and the "Welcome to…" message.

      The remainder of the text comes from the variable addressed by the pTitle parameter. Note the use of CRLF (defined as:

Constant CRLF = Concat(MakeBuff(1, 13), MakeBuff(1, 10));

to achieve vertical spacing).

Let's review the state code:

If Move;
[
    Move = 0; 
    ForceState(NextState); 
]

This is the basic Wizard control. When the Next button is clicked, the variable "Move" (the "pMove" parameter to the WizardEngine) will be set to non-zero, and the variable "NextState" (the "pState" parameter to the WizardEngine) will be set to the name of the next state to be used. So, the remaining code for a simple Wizard could be:

StateTwo [
    WTitle = "We are at the second step."; 
    If Move; 
    [ 
          Move = 0; 
          ForceState(NextState); 
    ] 
    ThirdStep [
    WTitle = "We are now at the third step."; 
    If Move; 
    [ 
          Move = 0; 
          ForceState(NextState); 
    ] 
]
Finish [
    If Move; 
    [ 
          Move = 0; 
          ForceState(NextState); 
    ] 
]
DoLotsOfWork [
  If 1 MoreWork; 
  [ 
    .. .. .. .. ..

Note that a title is not required for the "Finish" step, as the WizardEngine generates standard text.