next up previous contents index
Next: Fits functions Up: Dialog boxes Previous: Reading the fields

Example of dialog box

   SCRIPT SelectGraph()
     // Create the dialog window 
     win := Dialog:Start("TSFMATLAB","1D Graphic","Ok|Cancel")
     // The type of available graphics
     names := "Function Plot|Stairs|Bars"
     // Add the instructions for the user.
     mesg := "Please, select a graphic type"
     foo:= Dialog:InsertText(win,mesg,0)
     // Add the menu
     f_sel := Dialog:InsertMenuField(win,
                "types : ",names,1)
     // Add an empty line
     foo:= Dialog:InsertText(win," ",0)
     // Open the window and wait for the answer
     res := Dialog:Run(win)
      
     IF (res==0) THEN
       num := Dialog:GetFieldAsInteger(win,f_sel)
       IF (num==0) THEN
         PRINT "You have selected the Function Plot graph"
       ELSEIF (num==1) THEN
         PRINT "You have selected the Stairs graph"
       ELSEIF (num==2) THEN
         PRINT "You have selected the Bars graph"
       ENDIF
     ENDIF 
     // And close the window 
     foo := Dialog:Close(win) 
   ENDSCRIPT



Yann Mevel
1999-04-30