CWorks Posted August 14, 2006 Posted August 14, 2006 I finally found how to hide controls until a checkbox is clicked now how to get them to hide again when unchecked I think i got to page 27 here before finding out how to hide them must have read at least 10 of those #include <GUIConstants.au3> GUICreate("Testing", 150, 80, -1, -1) $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 8, 0, 121, 17) ;$test = GUICtrlRead($Checkbox1) GUISetState(@SW_SHOW) ;GuiSetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else If $msg = $Checkbox1 Then ;If BitAND(GUICtrlRead($Checkbox1),$GUI_UNCHECKED) Then $Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 16, 32, 97, 17) $input = GUICtrlCreateInput("input", 8, 56, 137, 21, -1, $WS_EX_CLIENTEDGE) EndIf EndSelect WEnd Exit
Moderators SmOke_N Posted August 14, 2006 Moderators Posted August 14, 2006 Should have asked... lol No need to keep drawing it like that though:#include <guiconstants.au3> $Main = GUICreate("Testing", 150, 80, -1, -1) $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 8, 0, 121, 17) $input = GUICtrlCreateInput("input", 8, 56, 137, 21, -1, $WS_EX_CLIENTEDGE) $Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 16, 32, 97, 17) ControlHide($Main, '', GUICtrlGetHandle($input)) ControlHide($Main, '', GUICtrlGetHandle($Checkbox2)) GUICtrlSetState($Checkbox2, @SW_HIDE) GUISetState(@SW_SHOW) ;GuiSetState() While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else If $msg = $Checkbox1 Then If GUICtrlRead($Checkbox1) = $GUI_CHECKED Then ControlShow($Main, '', GUICtrlGetHandle($input)) ControlShow($Main, '', GUICtrlGetHandle($Checkbox2)) Else ControlHide($Main, '', GUICtrlGetHandle($input)) ControlHide($Main, '', GUICtrlGetHandle($Checkbox2)) EndIf EndIf EndSelect WEnd Exit 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.
CWorks Posted August 14, 2006 Author Posted August 14, 2006 I tend to learn a lot more by trying to find the answers myself plus I found lots of other things along the way
Fossil Rock Posted August 14, 2006 Posted August 14, 2006 (edited) And now for something completely different.... #include <GUIConstants.au3> $Form1 = GUICreate("", 501, 290, 193, 126) $Edit1 = GUICtrlCreateEdit("", 184, 24, 273, 225) GUICtrlSetState(-1, $GUI_HIDE) GUICtrlSetData($Edit1, "") $Checkbox1 = GUICtrlCreateCheckbox("Edit box is hidden", 40, 56, 113, 17) $Label = GUICtrlCreateLabel("", 40, 112, 43, 17) $State = 0 ; 0 = Hidden 1 = Visible GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Checkbox1 _State() EndSwitch WEnd Func _State() If $State = 0 Then GUICtrlSetState($Edit1, $GUI_SHOW) GUICtrlSetData($Checkbox1,"Edit box is visible") $State = 1 Else GUICtrlSetState($Edit1, $GUI_HIDE) GUICtrlSetData($Checkbox1,"Edit box is hidden") $State = 0 EndIf EndFunc Edited August 14, 2006 by Fossil Rock Agreement is not necessary - thinking for one's self is!
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