Contents Previous Next Subchapters

Easy Dialog Setvalue Option
Syntax easydlg(option)
See Also controls

If there is only one argument to easydlg, and it begins with the text
     "setvalue, "
it is an Setvalue option. This option has the following syntax
     setvalue, 
namevalue
where name is the name of a field in the currently displayed dialog (which was created by easydlg). The result of this option is to set the value currently in the specified field. If the field type is checkbox, value is either true or false. If the field type is popupmenu, value is the new menu (without specifying its initial setting). The entries in the menu are separated by commas. If the field type is slider or spinbox, value is an integer between the field limits. If the field type is textfield, textbutton, labelfield, or labelbutton, value is any sequence of characters.

Program
     clear
     caption = "Setvalue Option"
     buttons = {"Go", "Exit"}
     message = { ...
          "Count increments each time", ...
          "you select the Go Option" ...
     }
     layout = { ...
          "textfield, File, 12, \omwin\temp.dat", ...
          "slider, Count, 12, 1, 1, 10" ...
     }
     easydlg(caption, buttons, message, layout)
     easydlg("dismiss, Exit")
     function Setvalue_Option(button) begin
          print "button =", button
          count = easydlg("Count")
          print "Count  =", count
          if button == "Exit" then return
          #
          count = int(atod(count))
          if count < 10 then count = count + 1
          count = ntoa(count)
          easydlg(["setvalue, Count,", count])
     end

Example
If you paste the program above into the command line, the following dialog will be displayed:
If you then select the Go button, the function Setvalue_Option will be called and it will print the text
     button = Go
     Count  = 1
in the Command window. In addition the dialog will stay on the screen and the value of the Count field will be changed to two. If you select the Exit button, the dialog will be dismissed, the function Setvalue_Option will be called, and it will print the text
     button = Exit
     Count  = 2
in the Command window.