previous up next print clean
Next: EXAMPLES Up: INTERACTIVE OBJECTS Previous: Object names

Object actions

Every object can also have a set of actions associated with it. These actions are performed whenever the object's string value is updated. If more than one action is specified for an object, they are performed in the order specified. The action can be one of five types:
QUIT
Exit the xtpanel program.
PRINT
Print a string to the standard output.
STRING
Set the object's string value to a new value.
ASSIGN
Set another object's string value to a new value.
SYSTEM
Execute a command.

Enormous flexibility is gained by letting any object execute a command as the result of interaction with it. Xtpanel can be used as a way of interactively connecting existing Unix programs that do not have interactivity built into them. An impressive example of this is an 80 line xtpanel script that acts as an interactive front end to the Unix calculator program, bc. This 80 line program (see the Calculator section below) has similar functionality to the 2070 line C program xcalc distributed with X windows.

An action may contain two types of special characters.

1.
The string value of any object can be used in an action string by referring to its name, preceded by a dollar sign. The following action string sets the value of its object to the current string value of another object whose name is otherobj:
action="STRING $otherobj"
2.
The string resulting from executing a command can be used in an action string by enclosing it in backquotes. For example, the following action string sets the value of an object to the current directory using the UNIX command pwd:
action="PRINT The current directory is `pwd`"
The aim of this design is to allow the user to tie together existing Unix programs while leaving as much flexibility as possible.


previous up next print clean
Next: EXAMPLES Up: INTERACTIVE OBJECTS Previous: Object names
Stanford Exploration Project
11/17/1997