Adding Expression Support to an Application

To add expression support to a tag:

First, in the Refresh() method of the module, use SafeRefresh() to update any parameters that may be assigned an expression. Here is a sample SafeRefresh() call for a variable P1:

\ExpressionManager\SafeRefresh(&P1, Parm[image\Number_Hatch.gifP1])

Second, add a PTypeToggle to the config folder of the tag for each variable that may be an expression.

To add expression support to a tag drawing method:

Often a tag drawing method variable X that can be a tag or a constant will be set in steady-state with PickValid(). Graphic calls then use X directly as an input. This won't work if X is extended to allow expressions, as Start() is a subroutine. Instead, introduce a new variable (for example, Xdata) and base the graphics on that. Then add new code similar to the following:

If Watch( 1, X );
[
\ExpressionManager\SafeAssign( &Xdata, ValueType(X) == 7 { Object } ? X : ValueType(X) == 4 { Text } ? \ExpressionManager\Start(X, Self, Self) : X );
]

Finally, make sure that there is a PTypeToggle in the Panel module for X, and ensure that the PTypeToggle is called with the EnableExpressions argument set to 1.