/
setRadioButtonHandler
setRadioButtonHandler
Description
Sets the event handler for the radio button user control that is specified by userControlID
.
Event handlers are simply scripts to be called when certain events happen. User controls get notified about changes in state when users interact with them. Each event handler flag takes as an argument a script (which must reside in your script directories).
To clear a event handler, pass the empty string, "", to the flag. If no options are specified, all handlers are reset, and the user control will not respond to any events.
Functional area
User Window
Command syntax
Syntax
setRadioButtonHandler userControlID[-click string] |
Arguments
Name | Type | Required | Comments |
---|---|---|---|
userControlId | int | yes | ID of user control to set event handler for. |
Flags
Name | Flag arguments | Argument type | Exclusive to | Comments |
---|---|---|---|---|
click | 1 | string | — | Specifies the script to call when the user clicks on the radio button. |
Return value
void
Examples
// Set the event handler for the User Radio Buttons. int $windowId; int $radio1, $radio2, $radio3; int $rect[4]; // First create a User Window to place the Controls on $windowId = `createWindow "MyWindow"`; // Create the User Controls on the Window. $rect[0] = 20; $rect[1] = 20; $rect[2] = 80; $rect[3] = 40; $radio1 = `createRadioButton $windowId -pos $rect -text "Option1"`; $rect[0] = 20; $rect[1] = 50; $rect[2] = 80; $rect[3] = 70; $radio2 = `createRadioButton $windowId -pos $rect -text "Option2"`; $rect[0] = 20; $rect[1] = 80; $rect[2] = 80; $rect[3] = 100; $radio3 = `createRadioButton $windowId -pos $rect -text "Option3"`; // Save the control IDs to our profile, so we can retrieve them // from the event handler writeProfileInt "MyWindowSection" "RadopButton1Id" $radio1; writeProfileInt "MyWindowSection" "RadopButton2Id" $radio2; writeProfileInt "MyWindowSection" "RadopButton3Id" $radio3; // Set the -click event handler for the Radio Buttons. When // the user mouse clicks on any of the Radio Buttons, // this script will be executed. RadioButtonClickHandler // must reside in one of the scripts directories. setRadioButtonHandler $radio1 -click "RadioButtonClickHandler"; setRadioButtonHandler $radio2 -click "RadioButtonClickHandler"; setRadioButtonHandler $radio3 -click "RadioButtonClickHandler";
Additional information
Related commands
, multiple selections available,