Reinhardt1julian Posted February 7, 2013 Posted February 7, 2013 I want to let autoit check if a checkbox is checked, and when it gets checked, it should do $GUI_ENABLE on a label on the same GUI. When it gets unchecked, it schould disable this label again.
Moderators Melba23 Posted February 7, 2013 Moderators Posted February 7, 2013 Reinhardt1julian, And what have you tried so far that has not worked? 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
Reinhardt1julian Posted February 7, 2013 Author Posted February 7, 2013 $TitelChecked = GUICtrlRead($Checkbox2) While 1 If $TitelChecked = 1 then GuiCtrlSetState($label 1, $GUI_ENABLE) EndIf WEND Or sth like this. But there's a Switch in the code, too.
Moderators Melba23 Posted February 7, 2013 Moderators Posted February 7, 2013 Reinhardt1julian,sth like thisYou do indeed need something like that - but I am not writing the rest of it for you. I suggest you post a nice complete script with suitable controls showing how you think it should work and then we can discuss why it does not. M23P.S. And why do you want to enable/disable a Label control anyway? 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
Reinhardt1julian Posted February 7, 2013 Author Posted February 7, 2013 It's all with the color picker i posted already. #include #include #include #include #include $Form1 = GUICreate("Test", 692, 266, 219, 134) $OK = GUICtrlCreateButton("OK", 224, 224, 105, 33) $Abbrechen = GUICtrlCreateButton("Abbrechen", 352, 224, 105, 33) $Checkbox2 = GUICtrlCreateCheckbox("Titel ändern zu", 32, 184, 91, 41) $Input1 = GUICtrlCreateInput("", 124, 195, 202, 21) GUICtrlSetLimit(-1, 20) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetCursor (-1, 5) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() $TitelChecked = GUICtrlRead($Checkbox2) If $TitelChecked == 0 Then GUICtrlSetState($Input1, $GUI_DISABLE) If $TitelChecked == 1 Then GUICtrlSetState($Input1, $GUI_ENABLE) Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Abbrechen Exit Case $OK GUICtrlDelete($Form1) EndSwitch WEnd
Moderators Melba23 Posted February 7, 2013 Moderators Posted February 7, 2013 Reinhardt1julian, It is much easier to wait until the checkbox is actioned and then adjust the state of the input: #include <GUIConstantsEx.au3> $Form1 = GUICreate("Test", 692, 266, 219, 134) $OK = GUICtrlCreateButton("OK", 224, 224, 105, 33) $Abbrechen = GUICtrlCreateButton("Abbrechen", 352, 224, 105, 33) $Checkbox2 = GUICtrlCreateCheckbox("Titel ändern zu", 32, 184, 91, 41) $Input1 = GUICtrlCreateInput("", 124, 195, 202, 21) GUICtrlSetLimit(-1, 20) GUICtrlSetState(-1, $GUI_DISABLE) GUICtrlSetCursor(-1, 5) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Abbrechen Exit Case $OK GUICtrlDelete($Form1) Case $Checkbox2 Switch GUICtrlRead($Checkbox2) Case $GUI_CHECKED GUICtrlSetState($Input1, $GUI_ENABLE) Case $GUI_UNCHECKED GUICtrlSetState($Input1, $GUI_DISABLE) EndSwitch EndSwitch WEnd Please ask if you have any questions. 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
Reinhardt1julian Posted February 7, 2013 Author Posted February 7, 2013 I didn't know that it was possible to do it like that. Thanks for teaching me
Moderators Melba23 Posted February 7, 2013 Moderators Posted February 7, 2013 Reinhardt1julian, My pleasure. 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
Reinhardt1julian Posted February 7, 2013 Author Posted February 7, 2013 (edited) Oh yeah, adn when a checkbox is unchecked, it returns 0, when it's checked 1, right? EDIT: nevermind, but i'll use the switch again AND i figured it out. Thanks Edited February 7, 2013 by Reinhardt1julian
Moderators Melba23 Posted February 7, 2013 Moderators Posted February 7, 2013 Reinhardt1julian,No - so go and see if you can find out what it does return in those 2 cases. M23Hint: Look in the Help file under GUICtrlRead and see where the various links take you. You will need to look in one of the standard include files as well. If you get stuck, just ask again and I will be more specific. 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
Reinhardt1julian Posted February 7, 2013 Author Posted February 7, 2013 And hopefully a last question: If you want to say If $Input NOT equals null (nothing in there), how do you do it? If $Input NOT = null or If $Input != null Or how
Moderators Melba23 Posted February 7, 2013 Moderators Posted February 7, 2013 Reinhardt1julian,You really do need to start reading the Help file before posting - asking simple questions like this one just makes us think you are really lazy. Take a look at the relevant Help file page here and see if you can find the "not equal" operator. 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
Reinhardt1julian Posted February 7, 2013 Author Posted February 7, 2013 I AM really lazy But i didn't really know about the help file. From now i'll search in there before posting, thanks
Reinhardt1julian Posted February 7, 2013 Author Posted February 7, 2013 (edited) And i can't find anything about the NULL thingy. That a variable is empty. It should check if the variable is empty or if it has text in it. Annnnnd found it IT's if not ($x = "") Edited February 7, 2013 by Reinhardt1julian
Moderators Melba23 Posted February 8, 2013 Moderators Posted February 8, 2013 Reinhardt1julian,Or you can use this - I tend to avoid using Not if I can as it is too easy to confuse the arguments: If $x <> ""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
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