Jump to content

Recommended Posts

Posted

Anyone can tell me how to know if the state of a checkbox is changed. For example the user in the GUI has selected a box that was previously not selected

Posted

#include <GUIConstants.au3>

GUICreate("My GUI Checkbox")
$checkCN = GUICtrlCreateCheckbox ("CHECKBOX 1", 10, 10, 120, 20)
$label1 = GUICtrlCreateLabel ("unchecked", 10, 50, 120, 20)
GUISetState ()

While 1
    $msg = GUIGetMsg()
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop

    If $msg = $checkCN Then 
        If IsChecked($checkCN ) Then 
            $state = 'checked'
        Else
            $state = 'unchecked'
        EndIf
        GUICtrlSetData ($label1 , $state)
    EndIf
Wend

Func IsChecked($control)
    Return BitAnd(GUICtrlRead($control),$GUI_CHECKED) = $GUI_CHECKED
EndFunc

See AutoIt helpfile for details...

Posted

#include <GUIConstants.au3>

GUICreate("My GUI Checkbox")
$checkCN = GUICtrlCreateCheckbox ("CHECKBOX 1", 10, 10, 120, 20)
$label1 = GUICtrlCreateLabel ("unchecked", 10, 50, 120, 20)
GUISetState ()

While 1
    $msg = GUIGetMsg()
        If $msg = $GUI_EVENT_CLOSE Then ExitLoop

    If $msg = $checkCN Then 
        If IsChecked($checkCN ) Then 
            $state = 'checked'
        Else
            $state = 'unchecked'
        EndIf
        GUICtrlSetData ($label1 , $state)
    EndIf
Wend

Func IsChecked($control)
    Return BitAnd(GUICtrlRead($control),$GUI_CHECKED) = $GUI_CHECKED
EndFunc

See AutoIt helpfile for details...

Thanks Zedna For your help

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
×
×
  • Create New...