OnChange attribute
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 Objects 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.
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.
Enable comment auto-refresher