Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

A “wizard” is a GX that uses a series of dialogs, often with different branches depending on selected parameters. Examples include the NEWMAP GX, for creating a new map, and IPJSET GX, for defining projections. It is even possible to call one wizard from another (as NEWMAP calls IPJSET). Wizard dialogs generally have “Back” and “Next” buttons, except for the last dialog, which usually has “Back” and “Finish” buttons. Control may terminate with the last dialog in the series, or be returned to the first dialog. The following is an outline of a simple wizard with two subdialogs, with control returned to the main dialog on completion. There is an “Options” button in the main dialog, which begins the wizard.

...

Code Block
i = MAIN_FORM;
while (i != DONE) {
     
   switch (i) {
       
      case MAIN_FORM:   // Main Dialog has “Ok”"œOk" and “Options”"œOptions" buttons
 
         Diag = Create_DGW("MAIN");
 
		 // --- Set info....
 
         iD = iRunDialogue_DGW(Diag);
         if (iD == -1) Cancel_SYS();
 
		 // --- Get Info...
 
         Destroy_DGW(Diag);            
 
         if(iD==0)
            i = DONE;
         else if(iD==OPTIONS)
            i = WIZARD1_FORM;
 
         break;
 
	  case WIZARD1_FORM:      // Wizard 1 has “Back”"œBack" and “Next”"œNext" buttons
 
		 Diag = Create_DGW("MAIN");
 
		 // --- Set info...
 
         iD = iRunDialogue_DGW(Diag);
         if(iD == -1) {
            i = MAIN_FORM;
            break;
         }
 
		 // --- Get Info...
 
         Destroy_DGW(Diag);            
 
           if(iD==BACK)
              i = MAIN_FORM;
           else if(iD==NEXT)
              i = WIZARD2_FORM;
 
         break;
     
	  case WIZARD2_FORM:         // Wizard 2 has “Back”"œBack" and “Finish”"œFinish" buttons
 
		 Diag = Create_DGW("MAIN");
 
		 // --- Set info....
 
         iD = iRunDialogue_DGW(Diag);
         if(iD == -1) {
            i = MAIN_FORM;
            break;
         }
 
		 // --- Get Info...
 
         Destroy_DGW(Diag);            
 
           if(iD==BACK)
              i = WIZARD1_FORM;
           else if(iD==FINISH)
              i = MAIN;
 
         break;
 
      case default:
 
         Abort_SYS(“I’m lost”"œI"™m lost");
 
   } // end while(i!=DONE)

...