next up previous contents index
Next: Label Size Issues Up: The label Button: Create/Edit Previous: ``Long Text'' Capability   Contents   Index


Script Labels

Xic provides the ability to embed a script or script reference in a label, which is executed when the user clicks on the label. These are created like any other label, but have the form

!!script [name=word] [path=path] [script text...]

The leading token in the label must be ``!!script'' to indicate that the label text is executable. This is followed by zero or more keyword/value pairs as shown, followed by the script text that will be executed. The keywords and values must be separated by `=' with no space. The value is a single token, which should be double-quoted if it contains white space. These are optional.

The keywords have the following interpretations.

name=some_word
The script label is rendered on-screen as some_word surrounded by a box. If no name is given, the word ``script''" is shown.

path=some_path
If this is given, then the script to be executed is given by some_path and any executable statements in the label are ignored. The some_path can be an absolute path to a script file, or can be the name of a script file expected to be found in the script search path.

Any remaining text is executed as script commands, if path is not given. For short scripts, semicolons can be used as command terminators in a single line. Otherwise, a text editor can be invoked on the label string by pressing the ``L'' (long text) button when creating the label.

Clicking on a script label will execute the script, and not select the label as with normal labels. To select a script label, hold Shift while clicking on the label, or drag over the label (area select). If a script label is selected, it will not execute when clicked on, but rather be deselected.

For example, suppose that a user has a large layout, with a small section that the user often needs to zoom into. The user can create a script label to perform the zoom operation. After zooming in, one can note the position and estimate the width of the drawing window. Then, one would create a label such as

!!script name=zoom Window(x, y, width, GetWindow())
and place it somewhere convenient. The x, y, and width above of course represent the actual values (in microns). Clicking on the label will always zoom to this area.


next up previous contents index
Next: Label Size Issues Up: The label Button: Create/Edit Previous: ``Long Text'' Capability   Contents   Index
Stephen R. Whiteley 2022-05-28