• • • • • • • • • • 6.4 •
OnChange attribute: When a user changes an input, the Definition attribute is updated with the new value and the OnChange attribute is evaluated. This provides an opportunity for your interface to make adjustments to the value just entered, or to other input fields, based on the value entered.
To set the OnChange attribute, you must first make it visible by turning it on in the Attributes dialog, found on the Object menu. Once this is turned on, the attribute appears in the Attribute panel and in the Object window for objects that have input nodes or have an OnChange that is set.
OnChange accepts an expression, using the same syntax as the Definition attribute; however, unlike a Definition, it also allows you to change other variable definitions or attributes using the Assignment Operator :=. It can even be used to change the definition of its own variable. For example, you can set OnClick for variable
X := "" & (Definition of X)
If a user enters a number, expression or something else, this will immediately convert it to text.
OnChange also provides an opportunity to hide, show, disable or enable other controls in your user interface. This is accomplished by calling the ChangeNodeVisibility function from within your OnChange expression.
For a Choice input, the OnChange attribute triggers when a new choice is selected. For a Checkbox, it triggers when the check is toggled. For a Table, it triggers after all changes to the table are accepted, such as when you press the green check or close the edit table window. OnChange also triggers when its Definition is changed by the assignment operator, which may happen from the OnChange attribute of another variable.