#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
Opt('GUIOnEventMode', 1)
Local $hGui, $iBtn, $iRd_1, $iRd_2
$hGui = GUICreate('Test', 200, 150)
GUISetOnEvent($GUI_EVENT_CLOSE, '_Exit')
$iRd_1 = GUICtrlCreateRadio('Radio 1', 20, 20, 160, 20)
GUICtrlSetState(-1, $GUI_CHECKED)
GUICtrlSetOnEvent(-1, '_Radio')
$iRd_2 = GUICtrlCreateRadio('Radio 2', 20, 60, 160, 20)
GUICtrlSetOnEvent(-1, '_Radio')
$iBtn = GUICtrlCreateButton('Change Radio', 50, 100, 100, 30)
GUICtrlSetOnEvent(-1, '_RadioChange')
GUISetState()
While Sleep(1000)
WEnd
Func _Radio()
Local $i_Rd_1 = GUICtrlSendMsg($iRd_1, $BM_GETCHECK, 0, 0), $a_State[2] = ['Checked', 'UnChecked']
ConsoleWrite('Radio 1: ' & $a_State[$i_Rd_1] & @LF)
ConsoleWrite('Radio 2: ' & $a_State[Not $i_Rd_1] & @LF)
ConsoleWrite('---' & @LF)
EndFunc
Func _RadioChange()
Local $i_Rd_1 = GUICtrlSendMsg($iRd_1, $BM_GETCHECK, 0, 0)
GUICtrlSendMsg($iRd_2, $BM_SETCHECK, $i_Rd_1, 0)
GUICtrlSendMsg($iRd_1, $BM_SETCHECK, Not $i_Rd_1, 0)
EndFunc ;==>_RadioChange
Func _Exit()
Exit
EndFunc ;==>_Exit