on_change

on_change — evaluates an expression when a variable changes value.

Syntax

on_change (symbol, s_exp)
    

Arguments

symbol

Any Gamma symbol.

s_exp

Any Gamma expression, usually a function or method call.

Returns

A list of the following items:

({class_name } fn_name fn_args...)

Where fn_name and fn_args correspond to the s_exp parameter.

Description

This function causes an expression (s_exp) to be evaluated when a variable (symbol) changes value. It can be undone with a call to remove_change.

Example

method AccessData.constructor ()
{
    on_change(#$DataSim:Sine, 
              `(@self).print_point($DataSim:Sine));
    after(3, `destroy(@self));
}