OnChange attribute


4.6  •  5.0  •  5.1  •  5.2  •  5.3  •  5.4  •  6.0  •  6.1  •  6.2  •  6.3  •  6.4  •  6.5

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.

You can use the OnChange attribute to trigger evaluation when an input node such as a Choice control, Checkbox or textual entry field is changed.

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 to

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.

See Also


You are not allowed to post comments.