Difference between revisions of "OnChange attribute"
DKontotasiou (talk | contribs) (Created page with "Category:Analytica User Guide <languages /> <translate> Analytica User Guide > '''OnChange attribute''': When a user changes an input, the '''Definition '''attribute ...") |
DKontotasiou (talk | contribs) |
||
Line 12: | Line 12: | ||
'''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 | '''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)''' | + | :'''X := "" & (Definition of X)''' |
If a user enters a number, expression or something else, this will immediately convert it to text. | If a user enters a number, expression or something else, this will immediately convert it to text. |
Revision as of 17:16, 26 August 2015
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 adjust- ments 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 texual 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.
See Also
Input and output nodes and their original variables <- | Event handling | -> Creating buttons |
Enable comment auto-refresher