Christopher Blue Posted February 25, 2007 Share Posted February 25, 2007 I am trying to use GUICtrlRead to fetch the text of my radio buttons, labeled "radio 1" "radio 2" "radio 3" and so on, but it is returning an empty string! How can I fix this? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 25, 2007 Moderators Share Posted February 25, 2007 I am trying to use GUICtrlRead to fetch the text of my radio buttons, labeled "radio 1" "radio 2" "radio 3" and so on, but it is returning an empty string! How can I fix this?GUICtrlRead get's the state of a radio button, not the text of it. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Valuater Posted February 25, 2007 Share Posted February 25, 2007 (edited) I am trying to use GUICtrlRead to fetch the text of my radio buttons, labeled "radio 1" "radio 2" "radio 3" and so on, but it is returning an empty string! How can I fix this?????http://www.autoitscript.com/forum/index.ph...c=41689&hl= Edited February 25, 2007 by Valuater Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 25, 2007 Moderators Share Posted February 25, 2007 (edited) #include <GUIConstants.au3> $GUI = 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.' & @CRLF & 'Text = ' & _GUICtrlGetText($GUI, $radio1)) Case $msg = $radio2 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED MsgBox(64, 'Info:', 'You clicked on Radio 2 and it is Checked.' & @CRLF & 'Text = ' & _GUICtrlGetText($GUI, $radio2)) EndSelect Wend Func _GUICtrlGetText($hGUI, $nCTRLID) Return ControlGetText($hGUI, '', $nCTRLID) EndFuncIf this is what you are trying to do. Edited February 25, 2007 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Christopher Blue Posted February 25, 2007 Author Share Posted February 25, 2007 I am trying to use the advanced mode of GUICtrlRead. From the AutoIt Help file:In 'advanced' mode the return value contains additional data of the control (see below)....TypeCheckbox, RadioAdditional ValueThe text of the control. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 25, 2007 Moderators Share Posted February 25, 2007 I am trying to use the advanced mode of GUICtrlRead. From the AutoIt Help file:I didn't know there was an advanced mode #include <GUIConstants.au3> $GUI = 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.' & @CRLF & 'Text = ' & GUICtrlRead($radio1, 1)) Case $msg = $radio2 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED MsgBox(64, 'Info:', 'You clicked on Radio 2 and it is Checked.' & @CRLF & 'Text = ' & GUICtrlRead($radio2, 1)) EndSelect WendStill gives me the correct result. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Christopher Blue Posted February 25, 2007 Author Share Posted February 25, 2007 I get function call parsing errors when I try to use _GUICtrlGetText. What version of AutoIt is it in? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 25, 2007 Moderators Share Posted February 25, 2007 I get function call parsing errors when I try to use _GUICtrlGetText. What version of AutoIt is it in?3.2.2.0It's simply ControlGetText() shouldn't be getting a function call error unless you only called the function with one parameter. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Christopher Blue Posted February 25, 2007 Author Share Posted February 25, 2007 OK, I will try out those suggestions, thanks! 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