Function Reference


GUICtrlCreateRadio

Creates a Radio button control for the GUI.

GUICtrlCreateRadio ( "text", left, top [, width [, height [, style = -1 [, exStyle = -1]]]] )

Parameters

text The text of the control.
left The left side of the control. If -1 is used then left will be computed according to GUICoordMode.
top The top of the control. If -1 is used then top will be computed according to GUICoordMode.
width [optional] The width of the control (default text autofit in width).
height [optional] The height of the control (default text autofit in height).
style [optional] Defines the style of the control. See GUI Control Styles Appendix.
    default ( -1) : none.
    forced styles : $BS_AUTORADIOBUTTON and $WS_TABSTOP if first radio in the group.
exStyle [optional] Defines the extended style of the control. See Extended Style Table.

Return Value

Success: the identifier (controlID) of the new control.
Failure: 0.

Remarks

To obtain the value of the control see GUICtrlRead().
To set or change information in the control see GUICtrlUpdate...() functions.

To combine styles with the default style use BitOR($GUI_SS_DEFAULT_RADIO, newstyle, ... ).
To use the values specified above you must #include <ButtonConstants.au3> in your script.

Default resizing is $GUI_DOCKHEIGHT.

Related

GUICoordMode (Option), GUICtrlUpdate..., GUIGetMsg

Example

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
        GUICreate("My GUI radio") ; will create a dialog box that when displayed is centered

        Local $idRadio1 = GUICtrlCreateRadio("Radio 1", 10, 10, 120, 20)
        Local $idRadio2 = GUICtrlCreateRadio("Radio 2", 10, 40, 120, 20)
        GUICtrlSetState($idRadio2, $GUI_CHECKED)

        GUISetState(@SW_SHOW) ; will display an  dialog box with 1 checkbox

        Local $idMsg
        ; Loop until the user exits.
        While 1
                $idMsg = GUIGetMsg()
                Select
                        Case $idMsg = $GUI_EVENT_CLOSE
                                ExitLoop
                        Case $idMsg = $idRadio1 And BitAND(GUICtrlRead($idRadio1), $GUI_CHECKED) = $GUI_CHECKED
                                MsgBox($MB_SYSTEMMODAL, 'Info:', 'You clicked the Radio 1 and it is Checked.')
                        Case $idMsg = $idRadio2 And BitAND(GUICtrlRead($idRadio2), $GUI_CHECKED) = $GUI_CHECKED
                                MsgBox($MB_SYSTEMMODAL, 'Info:', 'You clicked on Radio 2 and it is Checked.')
                EndSelect
        WEnd
EndFunc   ;==>Example