Fire Posted November 26, 2009 Share Posted November 26, 2009 Hi to all. I try create simple Gui which contain 1:)Checkbox 2:)Inputbox 3:)Button But i just wondering that why after the second time after uncheck checkbox and when i try to click on deactivated Inputbox its automatically enabled? For example my script below. Pliz say me where is my mistakes and what i`m doing incorrect or any other ways for fix it... Thanks. expandcollapse popup#include <GUIConstants.au3> #Region ### START Koda GUI section ### Form=Form1.kxf\Рабочий стол\Form1.kxf $Form1 = GUICreate("Form1", 633, 447, 303, 224) $Input1 = GUICtrlCreateInput("Input1", 120, 72, 169, 21) GUICtrlSetState(-1, $GUI_DISABLE) $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 464, 72, 65, 25) $Button1 = GUICtrlCreateButton("Button1", 232, 192, 97, 33, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Checkbox1 If BitAND(GUICtrlRead($checkbox1), $GUI_CHECKED) Then MsgBox(64, "Gui Chcked!", "Gui Checked") $Input1 = GUICtrlCreateInput("Input1", 120, 72, 169, 21) Else $Input1 = GUICtrlCreateInput("Input1", 120, 72, 169, 21) GUICtrlSetState(-1, $GUI_DISABLE) EndIf Case $Button1 If BitAND(GUICtrlRead($checkbox1), $GUI_CHECKED) Then MsgBox(64, "Gui Chcked!", "Gui Checked") $Input1 = GUICtrlCreateInput("Input1", 120, 72, 169, 21) Else MsgBox(64, "Not Checked!", "Not Checked!") EndIf EndSwitch WEnd [size="5"] [/size] Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 26, 2009 Moderators Share Posted November 26, 2009 Sh3llC043r,I am unsure what exactly you want to do. This script enables/disables the input depending on the checkbox state:#include <GUIConstantsEx.au3> ; <<<<<<<<<<<<<<<<<<<<<<< Note correct include to use #Region ### START Koda GUI section ### Form=Form1.kxf\??????? ????\Form1.kxf $Form1 = GUICreate("Form1", 633, 447, 303, 224) $Input1 = GUICtrlCreateInput("Input1", 120, 72, 169, 21) GUICtrlSetState(-1, $GUI_DISABLE) $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 464, 72, 65, 25) $Button1 = GUICtrlCreateButton("Button1", 232, 192, 97, 33, 0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 If BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) Then MsgBox(64, "Gui Checked!", "Gui Checked") GUICtrlSetState($Input1, $GUI_ENABLE) Else MsgBox(64, "Not Checked!", "Not Checked!") GUICtrlSetState($Input1, $GUI_DISABLE) EndIf EndSwitch WEndIf you require a different functionality (did I really just type that? ), please explain what you want to happen when the checkbox is clicked without the button being pressed. 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 Link to comment Share on other sites More sharing options...
Info Posted November 26, 2009 Share Posted November 26, 2009 #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 236, 70, -1, -1) $Button1 = GUICtrlCreateButton("Button1", 8, 40, 75, 25, $WS_GROUP) $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 8, 8, 97, 17) $Input1 = GUICtrlCreateInput("Input1", 112, 8, 121, 21) GUICtrlSetState($Input1, $GUI_DISABLE) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 If GUICtrlRead($Checkbox1) = 1 Then GUICtrlSetData($Button1,"checked") Else GUICtrlSetData($Button1,"unchecked") EndIf Case $Checkbox1 If GUICtrlRead($Checkbox1) = 1 Then GUICtrlSetState($Input1, $GUI_ENABLE) ; enable Input1 GUICtrlSetState($Input1, $GUI_FOCUS) ; focus Input1 Else GUICtrlSetState($Input1, $GUI_DISABLE) ; disable Input1 EndIf EndSwitch WEnd ? Link to comment Share on other sites More sharing options...
Fire Posted November 26, 2009 Author Share Posted November 26, 2009 Thanks you Melba23. I forgot about GUICtrlSetState($Input1, $GUI_DISABLE) Yes you fix it Thanks you very very much for this.You always help me. Info Thnk you very much too solved Thanks to all again. Now i know where is my mistakes. [size="5"] [/size] 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