Sign in to follow this  
Followers 0
Reinhardt1julian

Check if checkbox is enabled

15 posts in this topic

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.

Share this post


Link to post
Share on other sites



Reinhardt1julian,

And what have you tried so far that has not worked? :huh:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Reinhardt1julian,

sth like this

You 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. ;)

M23

P.S. And why do you want to enable/disable a Label control anyway? :huh:


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

I didn't know that it was possible to do it like that. Thanks for teaching me :)

Share this post


Link to post
Share on other sites

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#9 ·  Posted (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 by Reinhardt1julian

Share this post


Link to post
Share on other sites

Reinhardt1julian,

No - so go and see if you can find out what it does return in those 2 cases. ;)

M23

Hint: 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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

I AM really lazy :D But i didn't really know about the help file. From now i'll search in there before posting, thanks :)

Share this post


Link to post
Share on other sites

#14 ·  Posted (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 by Reinhardt1julian

Share this post


Link to post
Share on other sites

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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0