~L.a.p.i.g~ Posted April 12, 2006 Posted April 12, 2006 I am wondering how to check if a certain checkbox is checked and perform an action when you click a button. Help would be great.
Uten Posted April 12, 2006 Posted April 12, 2006 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))) Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling
Misha Posted April 13, 2006 Posted April 13, 2006 (edited) #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 April 13, 2006 by Misha
Micha1405 Posted April 13, 2006 Posted April 13, 2006 #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 ;-) My TrayToolBar
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