
ACTIONS
     An action is a  command  performed  when  a  user  interface
     object  has  changed  its  state, e.g. a button is pushed, a
     list item is chosen, a  slider  is  moved.  Actions  can  be
     specified in two forms, the simple "action={}" syntax or the
     conditional "test={}" syntax. If more  than  one  action  or
     test  is specified for an object then the individual actions
     are performed in the order in which they  are  specified  in
     the script file.

     There are ten basic types of  action:  NONE,  QUIT,  SYSTEM,
     PRINT,  STRING, ASSIGN, SET, CREATE, DESTROY, and EVAL. They
     are described below along with the syntax for using each.


     NONE      If action=NONE (or no  action  is  specified)  the
               object  will  just maintain its string representa-
               tion.  For dialogs, the string is the contents  of
               the text field; for sliders, the slider value; for
               choice, menubutton and  list  objects,  the  value
               associated  with the selected item. When an object
               with action=NONE is modified, its string  is  kept
               up  to  date,  available for use by other objects,
               but nothing else happens.


     QUIT string
               Quit xtpanel. The optional string is converted  to
               an  integer  (using  "atoi").  The xtpanel program
               then quits using the integer  as  its  exit  code.
               The simple quit button is written as:

               button={ label=QUIT action=QUIT }


     SYSTEM string
               Executes  the  UNIX  command  given  by  "string".
               Actions  that  do  not  begin  with an action type
               (NONE, QUIT, SYSTEM, PRINT, etc.) are  assumed  to
               be of type SYSTEM.


     PRINT string
               Prints "string" to xtpanel's standard output.


     STRING string
               Set the value of this object to "string".


     ASSIGN object string
               Set the value of the xtpanel  object  "object"  to
               "string".   Additionally the screen representation
               of the object is updated to reflect the new  value
               (if  it makes sense to do so).  For example if the
               value of a dialog is updated, the  text  field  of
               the  dialog  will contain the updated string. If a
               slider is updated the slider thumb will  be  moved
               to the corresponding position.


     SET object attribute string
               Sets the attribute "attribute" of object  "object"
               to  "string".   Attributes  are  object properties
               such as  foreground  or  background  color,  font,
               orientation, etc. See the section above on MISCEL-
               LANEOUS PARAMETERS to see which attributes can  be
               changed with the SET action.


     CREATE object string
               Create a new object  (or  objects),  specified  by
               "string".  "object"  is the name of the parent for
               this object. If "object" is  a  composite  object,
               such  as  a  window,  box, or form, the new object
               will be added to this parent, after all its  other
               children.  If  "object" is a non-composite object,
               such as a button, scrollbar, or text  field,  then
               the new object will be added to the same parent as
               "object", positioned just after "object". "string"
               is  an xtpanel script that defines the new object.
               The script can be of any length; multiple  objects
               can be created with a single CREATE action.


     DESTROY object
               Destroys the object named "object".  If  it  is  a
               composite  object  such as a window, box, or form,
               then all of its children will also be destroyed.


     EVAL string
               Interpret the string as  an  xtpanel  action,  and
               perform the action.  This allows you to avoid hav-
               ing to hardwire an action type in a  script;  EVAL
               actions  can  change dynamically. The usual string
               expansions take place before the evaluation,  thus
               the  action  to  be  executed  can  be  the string
               representation of another object.


     Action strings can contain the names of objects preceded  by
     a  dollar  "$" sign. The value of the string associated with
     the object is substituted in the generated string. The  spe-
     cial symbol "$val" is used to refer to the string associated
     with the current object. An object name can be  enclosed  in
     brackets  to avoid syntactic ambiguity. You can use "$(val)"
     or "$val", the first form is  recommended.  If  you  do  not
     enclose  the  name  in brackets it will be assumed to end at
     the next space, dollar sign or quote.  You  should  give  an
     object  a name if you intend to use its string in the action
     of another object, though default  names  are  assigned,  as
     detailed in the description of objects above.  A double dol-
     lar sign "$$" is used to generate a  single  dollar  in  the
     generated string.

     The rules for expanding an action string  are  the  same  as
     those  described above for general strings in scripts. First
     the values of  other  objects  are  expanded  and  then  any
     backquoted  strings  are  evaluated. The major difference in
     actions is that the format  string  is  expanded  at  action
     time.  This means that the object value in the string is the
     value at action time. However it also means that  you  won't
     be informed of any errors until action time.

     Other action arguments such as "object" and "attribute"  are
     most commonly simple one-word character strings: the name of
     the object or attribute, with no dollar sign.   However,  to
     make  actions  more dynamic, an xtpanel variable can be used
     in place of these. "object" or "attribute" can be  the  name
     of  an  object  preceeded by a dollar "$" sign. The value of
     the string associated with that object will  be  substituted
     in.   Of  course,  the  value must be a valid object name or
     attribute name for the correct action to result.

     Following are two examples of using actions.

     Here is a choice object that uses its value as  a  parameter
     for an imaginary system command, showcolor:

     choice={ label=colors value="255 0 0" action="showcolor -rgb $(val)"
              item={ label=red value="255 0 0" }
              item={ label=green value="0 255 0" }
              item={ label=blue value="0 0 255" }
            }

     In this next example, the list item has no action specified.
     Actions  default  to  type  NONE;  the  list will maintain a
     string containing the value of the selected list  item,  but
     will  do nothing more.  Here a separate button is used to do
     something with the list's output:

     message={ label="press button to find out which item is selected" }
     list={ label=numbers name=listout
              itemlist={ list="1 2 3"
            }
     button={ label="press for answer"
              action="PRINT list selection is $(listout)" }

     In this example the assign action is used to reset the value
     of  a  dialog  to  a  known  string (fred). The reset button
     assigns the string to the dialog.  The dialog itself has two
     actions,  the  first  prints the value of the text field and
     the second action quits xtpanel.

     dialog={ label=dialog value="fred"
              action="PRINT I am $(val)"
              action=QUIT
            }

     button={ label=RESET action="ASSIGN dialog fred" }


     In the final example the user can select a file from all the
     ".ps"  files  in  the  current  directory.  The file is then
     viewed with the ghostview program:

     button={ label=QUIT action=QUIT }
     list={ label="Choose a file" action="ghostview $(val)"
              itemlist={ list=`echo *.ps`  }
            }
