scriptlets


Scriptlet is a sequence of Pd atoms (symbols and floats), which is to be transfered to the pd-gui process for execution.  On the pd-gui side, a scriptlet is executed as one, or several Tcl commands.  Generic scriptlet handling is done by the tot.  Other toxy classes use scriptlets for more specific purposes, which could be, as in the widget's case, simplifying access to particular Tk features (such as widget configuration options and event bindings).

Symbols in a scriptlet may contain special dot-sequences: dot-parameters, dot-names, callback brackets, and dot-separators.  All of these start with a dot, followed by a hash, a dash, a hat, a tilde, a grave, a colon, or an opening or closing angle or round bracket.

Scriptlets may be parametrized, by using either numbered, or named dot-parameters.  The numbered dot-parameters are .#1 through .#9, and evaluate to subsequent arguments of that Pd message, which triggers evaluation.  The named dot-parameters are of the form .#<name>, where the <name> is a single word of any length, starting with a letter.  For a successful evaluation of a named dot-parameter, its value has to be previously defined, for example, as an initializer's argument property of the widget class.

A scriptlet may have its destination window, which is a Tk toplevel widget containing the graphical representation of a patch.  It may also have its destination item, which is a canvas item (e.g. of a widget class) manipulated by a scriptlet.

Dot-names are variables evaluated as pathnames or field names:

Any scriptlet may contain callback sequences, delimited with callback brackets.  After being evaluated by Tcl, the contents of a callback sequence is sent back as a Pd message, either through a scriptlet-handling object's outlet, or to a specified global Pd target, or back to the object itself.  The three types of callback sequences are:

The usual scenario is for a callback sequence to be executed through a binding to a Tcl event.  Therefore, for convenience, the callback's body is implicitly grouped, and all substitutions are delayed until processing of the event.  If, for any reason, grouping has to be removed, the opening bracket should be preceded with eval.  If substitutions are to be performed immediately, the opening bracket should be preceded with subst.

All the above dot-sequences are persistent, which means, that toxy objects maintain them (save into a file, show in an editor window, etc.) in a dot-escaped state -- such sequences are resolved anew for every transfer.  Dot-separators, on the other hand, are always immediately evaluated as follows:


complaints to this address