You can use the Set Script message to have a display box control (for example, a button box or combo box) run a script when it is clicked with the mouse.
Alternatively, you can use the Set Function message to have a display box control run a specific function where the first argument is the specific display box. Set Function enables you to build more object-oriented scripts and to create a larger system.
<< Set Function(
The preceding script creates a button box with the name “Press me”. When the button is clicked, the function called by Set Function changes the name to “Thanks”.
If you have multiple buttons that can be serviced by the same script, Set Function is much simpler than Set Script because it tells you which button was pressed. In this example, both check boxes use the script that begins on the first line.
)// <<Get Selected returns a list of the currently checked (selected) items
New Window( "Example",
In the following example of Set Function, the same function is used to create the buttons.
New Window( "Cash Box",
total = 0;
total = 0;
); /* loop creates the buttons and shows that the same function
buttonFunction = Function( {this},
•
|
The Set Script and Set Function messages work for button boxes, calendar boxes, check boxes, combo boxes, list boxes, popup boxes, radio boxes, range slider boxes, slider boxes, and spin boxes.
|
•
|
You cannot use both Set Script and Set Function at the same time. Use Set Function if you need to reference a specific display box object.
|