French version
This page is still under construction
 

General information

A Wizard is a small program which helps the user to configure software, hardware, ...

For instance, it can be used for :

  1. Computer administration
  2. Configuring  user's environment (Shell, window manager).
  3. Creation of HTML or TeX page...
  4. Software installation and configuration.

Notion

The graphic interface of a wizard is composed of 4 elements
  1. A picure on the left (here /usr/lib/tk/demo/images/earth.gif)
  2. On bottom-right : 3 buttons (Previous, Next, Cancel) allowing navigation in the various screens
  3. On top-right : the title and a short description of the screen
  4. On center-right : Some interface elements.
Since UNIX world was not, originally, graphical-oriented, wizard concept is not as developped as in some other systems.
But, with Tcl-Tk, it is fairly easy to rapidely construct some wizards. An exemple of such a wizard can be viewed on the screen-shots below (this wizard is intended to facilitate the creation of a new user).
 

Software structure

The software architecture is organized in 2 stages:
  1. Creation of all the screens,
  2. Definition of actions that take place when going from one screen to an other.
Each screen is associated with a number (screen 0,1,2...).

 

Creation of the screens

The creation of one screen is made easier by the use of functions. One function creates automatically the title, the description zone and the zone containing the fields where the user interact with the wizard.
 

Actions that take place when going from one screen to an other

Two functions are called, the first when a screen is displayed and  the other one when one lives the current screen. These functions have both among their  parameters the index of the current screen . The function called when we leave one screen turns over a booleen, which indicates if it is allowed going to the next screen. In fact, the developer will need to verify if the user correctly filled the fields of the interface, and to act in consequense (Appearance of a Message Box).

Example of a 'adduser' Wizard

It is an example of Wizard (in fact this work is still in progress, it does not really add a user).  
     
     
     
     
  1. Source code
 
    1. Tck-Tk
    2. Libsx
    3. Motif

Skeleton of a wizard under X11

AWizard is a basic concept which could be implemented in many languages

In algorithmic language, a wizard can be described as follow :
 

  title = "pseudo-code "
 
 
 
create screen 0 " Introductive  screen " " Description of the first screen "
...
create screen N " Screen N title " " Description of screen N "
create two Widgets 'input' and 'list' (for example)
...
create the last screen "Apply " " User's inputs "
create apply button callback apply
InputScreen (N)
switch (n) {
case ...
case N: if Widget 'input' is empty then message box "You must fill this field " return false
if no choice has been done in Widget 'list' then message box " You must choose one item " return false
}
Apply { if Action = Ok then message box " Good ;-)"
else message box " Sorry, you loose :-( "
exit
}

The courageous developers will thus choose to make an Wizard in their favorite language. The following list provides skeletons or template of Wizards in some languages:

In tcl-tk

 
Function Parameter
InputScreen  Number of the new screen 
OutputScreen  Number of the old screen

Most of the work done by the wizard is carried out in these two functions :

proc InputScreen { N } {  switch -- $$n {
 

 0 { puts " InputScreen 0 " }

 1 { puts " InputScreen 1 " }

 } }

 proc OutputScreen { N } { switch -- $$n {
 

 0 { puts " OutputScreen 0 " }

 1 { puts " OutputScreen 1 " }

 } }

 

  • Athena Widget: libsx

  •  

    As in Tcl-tk, each dialog screen will be created with a number

     / * Wizard global variables * /

     int current_screen = 0;

     int index_screen=0;

    The MakeAssistantScreen function will create a form, a label title, and a descriptive text.
     

     void MakeAssistantScreen(char * title, char * description);

    Then it will be enough to create Widgets and to call AddWidget.
     

    void AddWidget(Widget W);

    The remainder is automatic.

     

  • Action for all the screens, opening and closing
  •  At each screen change, two functions are called :
     

    Function Parameter
    InputScreen Number of the new screen 
    OutputScreen  Number of the old screen

    These two functions make it possible to influate the wizard while it is in use. The InputScreen function is called when one enter in a new screen. Conversely, the OutputScreen function is called when one leaves the current screen, and return a boolean which indicates if this change is allowed. They have both among their parameters, the number of the screen concerned with the action. It will be enough for you to make a switch ... case on this number and to act in consequence.

     

    Exemple:
     

    InputScreen in C
    switch (n)

    { case 2 :

    sprintf(homedir,"/home/%s",username);
    SetStringEntry(Whomedir,homedir);

    break;

    ...

    }
     
    OutScreen in C:
    switch (n)

    { case 0:

    strcpy(username,GetStringEntry(Wnomuser));

    if (strchr(username,' ')!=NULL) {

    printf("A username cannot contains the space char");

    GetYesNo("A username cannot contains space char");

    return(FALSE);

    Here FALSE indicates that one does not want to change screen since an error occurs.
    }

        ...

    }

     

    Make a Wizard

     You can help me and the Wizard project, send me :

    Thank you
     
     

    To Do

    Realization of new Wizards: Creates new skeletons using:
    thank's to Vincent Barré for tranlation
    Thank you for your visit 
    Charles Vidal