Guest zitto Posted January 20, 2005 Share Posted January 20, 2005 Hello all, I'm new in AutoIt scripting, and I have a little question. I'd like to know wich function/keyword permits (in the code below) to know which radio button is selected ? I think it's quite easy, but I just can't find :"> #include <GUIConstants.au3> GUICreate("My GUI radio") ; will create a dialog box that when displayed is centered GuiCtrlCreateGroup("", 10, 10, 150, 150); open group $radio1 = GUICtrlCreateRadio ("Radio 1", 20, 20, 100, 20) $radio2 = GUICtrlCreateRadio ("Radio 2", 20, 40, 100, 20) $radio3 = GUICtrlCreateRadio ("Radio 3", 20, 60, 100, 20) GUICtrlSetState ($radio1,$GUI_CHECKED) GUICtrlCreateGroup ("",-99,-99,1,1) ;close group GUICtrlCreateButton("Which radio is selected ?",20,200,200,20) GUISetState () ; will display an dialog box with 1 checkbox ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() ; Write here the script that when click on button, a msgbox is displayed with a message ; telling which radio is selected. If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend Link to comment Share on other sites More sharing options...
SlimShady Posted January 20, 2005 Share Posted January 20, 2005 #include <GUIConstants.au3> GUICreate("My GUI radio"); will create a dialog box that when displayed is centered GuiCtrlCreateGroup("", 10, 10, 150, 150); open group $radio1 = GUICtrlCreateRadio ("Radio 1", 20, 20, 100, 20) $radio2 = GUICtrlCreateRadio ("Radio 2", 20, 40, 100, 20) $radio3 = GUICtrlCreateRadio ("Radio 3", 20, 60, 100, 20) GUICtrlSetState ($radio1,$GUI_CHECKED) GUICtrlCreateGroup ("",-99,-99,1,1);close group $Button_1 = GUICtrlCreateButton("Which radio is selected ?",20,200,200,20) 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 = $Button_1 Dim $SelRadBtn If GUICtrlRead($radio1) = $GUI_CHECKED Then $SelRadBtn = "radio1" ElseIf GUICtrlRead($radio2) = $GUI_CHECKED Then $SelRadBtn = "radio2" ElseIf GUICtrlRead($radio3) = $GUI_CHECKED Then $SelRadBtn = "radio3" EndIf If $SelRadBtn <> "" Then MsgBox(64, "Test", "Selected radio button: " & $SelRadBtn) EndIf EndSelect Wend Link to comment Share on other sites More sharing options...
Guest zitto Posted January 20, 2005 Share Posted January 20, 2005 (edited) Tanks a lot !! I was on the way to find. $GUI_CHECKED was missing !!! Thx Slim ! Edited January 20, 2005 by zitto Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now