3.3 Adding Component Script
Note: Text element script does not re-execute when the user makes Viewsheet selections. To re-execute script that modifies a Text element, place the script in the onLoad Handler.
A script attached to a Viewsheet component is evaluated whenever the component is refreshed, which includes initial Viewsheet loading, and user interactions with the component. The script can change the properties of the element, including visibility.
Properties set in script override properties set in the component 'Properties' dialog box.
In fact, a component script can access any component in the Viewsheet. However, it is not good practice to modify the properties of one element from within the script of another element. See Debugging a Viewsheet Script for alternative approaches.
To attach a script to a Viewsheet component, follow the steps below:
1. Right-click the desired component, and select 'Properties' from the context menu. This opens the 'Properties' dialog box.
2. Click the Script tab to open the Script Editor.
3. For a Text component, select the Script or onClick radio button at the bottom of the dialog box.
Note: A script can reference properties of its hosting component without full qualification. E.g., for a script on component “SelectionList1”, 'SelectionList1.selectedObject' and 'selectedObject' refer to the same property.
4. Type the desired script in the text field.
See Also
Script Evaluation Order, for the order of script evaluation.
| << 3.2 Adding Property Script (Expressions) | © 1996-2013 InetSoft Technology Corporation (v11.4) | 3.3.1 Common Component Properties >> |