BryonR Posted March 12, 2009 Posted March 12, 2009 I have the following code If BitAND(GUICtrlRead($ittab_radio_difcomp), $GUI_CHECKED) = $GUI_CHECKED Then $ittab_lbl_computername = GUICtrlCreateLabel("Computer Name:" ,100,208,193,17) GUICtrlSetFont(-1, 12, 400, 0, "Times New Roman") GUICtrlSetColor(-1, 0x000080) $ittab_input_computername = GUICtrlCreateInput("", 100,300,193,17) GUICtrlSetFont(-1, 12, 400, 0, "Times New Roman") GUICtrlSetColor(-1, 0x000080) EndIf However when I check on the radio its not displaying the input or label. Thanks! Bryon
GEOSoft Posted March 12, 2009 Posted March 12, 2009 It's working for me so make sure that you are not re-using a variable name and that your control positioning is correct. I would also suggest that it's a better idea to create the controls when you create the GUI and then set their stae to hidden. All you have to do then is change the states when the radio is clicked. Or at the very least declare the label and input control names at the top of the script Global $ittab_lbl_computername, $ittab_input_computername George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
BryonR Posted March 12, 2009 Author Posted March 12, 2009 I'm still having the same problem, here is the code. #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 633, 447, 192, 124) $Radio1 = GUICtrlCreateRadio("Radio1", 112, 88, 113, 17) $Radio2 = GUICtrlCreateRadio("Radio2", 120, 112, 113, 17) If BitAND(GUICtrlRead($Radio2), $GUI_CHECKED) = $GUI_CHECKED Then $Label1 = GUICtrlCreateLabel("Label1", 336, 120, 36, 17) GUICtrlSetFont(-1, 12, 400, 0, "Times New Roman") GUICtrlSetColor(-1, 0x000080) EndIf GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd
Moderators Melba23 Posted March 12, 2009 Moderators Posted March 12, 2009 BryonR,You need to put your If BitAND(GUICtrlRead($Radio2) section inside the While...WEnd loop. At the moment it is only being looked at as the code creates the GUI - and so obviously the radio is not set. Look at this code - I have included GEOSoft's advice to create the label at the beginning and then use "show/hide" to react to the radio:#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 633, 447, 192, 124) $Radio1 = GUICtrlCreateRadio("Radio1", 112, 88, 113, 17) $Radio2 = GUICtrlCreateRadio("Radio2", 120, 112, 113, 17) $Label1 = GUICtrlCreateLabel("Label1", 336, 120, 36, 17) GUICtrlSetState(-1, $GUI_HIDE) GUICtrlSetFont(-1, 12, 400, 0, "Times New Roman") GUICtrlSetColor(-1, 0x000080) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch ; This is the part you needed If BitAND(GUICtrlRead($Radio2), $GUI_CHECKED) = $GUI_CHECKED Then GUICtrlSetState($Label1, $GUI_SHOW) Else GUICtrlSetState($Label1, $GUI_HIDE) EndIf WEndYou will see that the label flickers when it is visble and you move the mouse - that is because every time there is a message from the GUI, the loop finds that the radio is checked and the GUISetState is actioned. A good way to cure this is to use a flag to show the state of the label and then only action the GUISetState when the radio and state do not match:#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 633, 447, 192, 124) $Radio1 = GUICtrlCreateRadio("Radio1", 112, 88, 113, 17) $Radio2 = GUICtrlCreateRadio("Radio2", 120, 112, 113, 17) $Label1 = GUICtrlCreateLabel("Label1", 336, 120, 36, 17) GUICtrlSetState(-1, $GUI_HIDE) GUICtrlSetFont(-1, 12, 400, 0, "Times New Roman") GUICtrlSetColor(-1, 0x000080) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $Radio_Checked = False While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch ; This is the part you needed If BitAND(GUICtrlRead($Radio2), $GUI_CHECKED) <> $Radio_Checked Then $Radio_Checked = Not $Radio_Checked If $Radio_Checked = True Then GUICtrlSetState($Label1, $GUI_SHOW) Else GUICtrlSetState($Label1, $GUI_HIDE) EndIf EndIf WEndI hope this is clear - ask if you do not understand.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
GEOSoft Posted March 12, 2009 Posted March 12, 2009 Better yet. #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 633, 447, 192, 124) $Radio1 = GUICtrlCreateRadio("Radio1", 112, 88, 113, 17) $Radio2 = GUICtrlCreateRadio("Radio2", 120, 112, 113, 17) $Label1 = GUICtrlCreateLabel("Label1", 336, 120, 36, 17) GUICtrlSetState(-1, $GUI_HIDE) GUICtrlSetFont(-1, 12, 400, 0, "Times New Roman") GUICtrlSetColor(-1, 0x000080) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $Radio_Checked = False While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Radio2 If BitAND(GUICtrlRead($Radio2), $GUI_CHECKED) Then If GUICtrlGetState($Label1) > $GUI_SHOW Then GUICtrlSetState($Label1, $GUI_SHOW) Else If GUICtrlGetState($Label1) < $GUI_HIDE Then GUICtrlSetState($Label1, $GUI_HIDE) EndIf Case Else EndSwitch WEnd George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
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