Function Reference

GUICtrlCreateRadio

Creates a Radio button control for the GUI.

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

 

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: Returns the identifier (controlID) of the new control.
Failure: Returns 0.

 

Remarks

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

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>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $radio1, $radio2, $msg
    GUICreate("My GUI radio") ; will create a dialog box that when displayed is centered

    $radio1 = GUICtrlCreateRadio("Radio 1", 10, 10, 120, 20)
    $radio2 = GUICtrlCreateRadio("Radio 2", 10, 40, 120, 20)
    GUICtrlSetState($radio2, $GUI_CHECKED)

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

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop
            Case $msg = $radio1 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED
                MsgBox(64, 'Info:', 'You clicked the Radio 1 and it is Checked.')
            Case $msg = $radio2 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED
                MsgBox(64, 'Info:', 'You clicked on Radio 2 and it is Checked.')
        EndSelect
    WEnd
EndFunc   ;==>Example