Sign in to follow this  
Followers 0
MrChris

help with $GUI_Checked

4 posts in this topic

I am trying to run a function if a check box is checked and and button is pressed cant get it to work. I tried reading the GUICtrlSetState and GUICtrlGetState but am not understanding it.

Here is what I had/have that aint workin

$Button1 = GUICtrlCreateButton("Test button", 224, 16, 137, 33, 0)
GUICtrlSetTip(-1, "this is a test button")
GUICtrlSetOnEvent(-1,"FileSetup")

$CheckBox1 = GUICtrlCreateCheckbox("This is a test checkbox", 16, 56, 137, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
GUICtrlSetTip(-1, "this is a hint for this check box")

Func FileSetup()
    GUISetState(@SW_HIDE)
    If $CheckBox1 = $GUI_CHECKED Then
        MsgBox(1024,"This is a test","This is a test")
    EndIf
EndFunc

Thanks,

MrChris

Share this post


Link to post
Share on other sites



Did you check the Gui Forum 1st? :whistle: as this is GUI stuff.

Use GUICtrlRead on the control handle.

$Button1 = GUICtrlCreateButton("Test button", 224, 16, 137, 33, 0)
GUICtrlSetTip(-1, "this is a test button")
GUICtrlSetOnEvent(-1,"FileSetup")

$CheckBox1 = GUICtrlCreateCheckbox("This is a test checkbox", 16, 56, 137, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
GUICtrlSetTip(-1, "this is a hint for this check box")

Func FileSetup()
    GUISetState(@SW_HIDE)
    If GUICtrlRead($CheckBox1) = $GUI_CHECKED Then
        MsgBox(1024,"This is a test","This is a test")
    EndIf
EndFunc

:)

Share this post


Link to post
Share on other sites

#include <GUICONSTANTS.AU3>
Opt('GUIONEVENTMODE', 1)

$MAIN = GUICreate('SOMETITLE', 500, 300)
$Button1 = GUICtrlCreateButton("Test button", 224, 16, 137, 33, 0)
GUICtrlSetTip(-1, "this is a test button")
GUICtrlSetOnEvent(-1,"FileSetup")

$CheckBox1 = GUICtrlCreateCheckbox("This is a test checkbox", 16, 56, 137, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
GUICtrlSetTip(-1, "this is a hint for this check box")
GUISetState()

While 1
    Sleep(10000)
WEnd

Func FileSetup()
    GUISetState(@SW_HIDE)
    If BitAND(GUICtrlRead($CheckBox1), $GUI_CHECKED) = $GUI_CHECKED Then
        MsgBox(1024,"This is a test","This is a test")
    EndIf
EndFunc


[center]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.[/center]

Share this post


Link to post
Share on other sites

@ MHz

Sorry I forgot I should post/read GUI related questions in the GUI form. But thanks that did the trick.

MrChris

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