/
createRadioButton
createRadioButton
Description
Creates a radio button user control on the user window specified by windowID
. A radio button is similar to a check box, except that its checked value is mutually exclusive with other radio buttons. Thus, if one radio button gets checked, the other radio buttons in the group automatically uncheck.
The control is initially placed in the top-left corner of the user window, and must be placed by using the -pos
option, or by using the setControlPos command.
The command returns the control ID of the user control, which should be saved for later operations on the control.
Functional area
User Window
Command syntax
Syntax
createRadioButton parentWindowID [-hidden] [-text string] [-pos integer array] [-form integer] [-first] [-left] [-check] |
Arguments
Name | Type | Required | Comments |
---|---|---|---|
windowId | int | yes | ID of user window to place the control on. |
Flags
Name | Flag arguments | Argument type | Exclusive to | Comments |
---|---|---|---|---|
first | 0 | — | — | Specifies that this radio button is the first in a group of radio buttons. This flag must be set for the radio buttons in a group to work properly. |
left | 0 | — | — | Specifies that the button text appear on the left side of the radio button. The default is text on the right. |
check | 0 | — | — | Specifies that the radio button is initially "checked". The default is "unchecked". |
hidden | 0 | — | — | Specifies that the control should be hidden initially. Call showControl to subsequently make it visible. The default is for it to be visible. |
text | 1 | string | — | The text that gets displayed with the control. The default is no text. |
pos | 1 | integer array | — | A four-element int array representing a rectangle, which specifies the initial size/position of the control relative to the top left corner of the user window. The element order is Left, Top, Right, and Bottom. The default is a radio button 20 units high by 50 units wide. |
form | 1 | integer | — | Control ID of the form user control which will dynamically position this control. |
Return value
integer
Examples
// Create a Radio Button User Control. int $windowId; int $radioId1; int $radioId2; int $radioId3; int $rect[4]; // First create a User Window to place the Controls on $windowId = `createWindow "MyWindow"`; // Specify the size and position of the first Radio Button $rect[0] = 0; // Left $rect[1] = 0; // Top $rect[2] = 100; // Right $rect[3] = 20; // Bottom // Create the first Control on the Window. Make sure to // set the -first flag so that all three can work together $radioId1 = `createRadioButton $windowId -text "Option 1" -pos $rect -check -first`; // Now position the second Radio Button $rect[0] = 0; // Left $rect[1] = 25; // Top $rect[2] = 100; // Right $rect[3] = 45; // Bottom // ... and create it $radioId2 = `createRadioButton $windowId -text "Option 2" -pos $rect`; // And finally the third Radio Button $rect[0] = 0; // Left $rect[1] = 50; // Top $rect[2] = 100; // Right $rect[3] = 70; // Bottom $radioId3 = `createRadioButton $windowId -text "Option 3" -pos $rect`;
Additional information
Related commands
, multiple selections available,