Jump to content

Checkboxes...


Recommended Posts

From the help file

#include <GUIConstants.au3>

GUICreate ("My GUI (GetControlState)")
$n=GUICtrlCreateCheckbox ("checkbox",10,10)
GUICtrlSetState (-1,1)       ; checked 

GUISetState ()    ; will display an empty dialog box

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

msgbox (0,"state",StringFormat("GUICtrlRead=%d\nGUICtrlGetState=%d",GUICtrlRead($n),GUICtrlGetState($n)))
Link to comment
Share on other sites

#include <GUIConstants.au3>

Opt ("GUIOnEventMode", 1)

GUICreate ("My GUI")

$n = GuiCtrlCreateCheckbox("CheckBox",10,10)

GuiCtrlSetOnEvent( $n , "Function")

GuiSetState()

Func Function ()

$readen=GuiCtrlRead($n)

if $readen = 1

msgbox(0,"Is Set Check)

Else

MsgBox(0,"Isnt checked")

Endif

EndFunc

This also might work no?

Edited by Misha
Link to comment
Share on other sites

#include <GUIConstants.au3>

GUICreate ("My GUI")

$n = GuiCtrlCreateCheckbox("CheckBox",10,10)

;GuiCtrlSetOnEvent( $n , "Function")

GuiSetState()

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_EVENT_CLOSE

MsgBox(0, "", "Dialog was closed")

Exit

Case $msg = $n

Function ()

EndSelect

WEnd

Func Function ()

$readen=GuiCtrlRead($n)

if $readen = 1 then

msgbox(0,"","Is Set Check")

Else

MsgBox(0,"","Isnt checked")

Endif

EndFunc

;Now it works ;-)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...