flxfxp Posted April 28, 2009 Posted April 28, 2009 hello, I would like to check if a box is checked: expandcollapse popup#include <GUIConstantsEx.au3> $height = 30 Func CreateOption($labelname) $boxname = $labelname + "Box" $boxname = GUICtrlCreateCheckbox($labelname, 15, $height, 97, 17) ;MsgBox(1, "af", $boxname) $height = $height + 20 Return $boxname EndFunc ;how many labels? $labelnumber = 10 $windowheight = $labelnumber * 10 + 185 $buttonheight = $labelnumber * 10 + 135 GUICreate("installr", 130, $windowheight) GUICtrlCreateLabel("What to install?", 10, 10) CreateOption("firefox") CreateOption("winrar") CreateOption("lol") CreateOption("test2") CreateOption("test4") CreateOption("test5") CreateOption("test6") CreateOption("test7") CreateOption("test8") CreateOption("test9") $ExitID = GUICtrlCreateButton("Exit", 70, $buttonheight, 50, 20) $InstallButton = GUICtrlCreateButton("Install", 10, $buttonheight, 50, 20) GUICtrlCreateLabel("FLX installr - 2008", 13, $buttonheight + 25) GUISetState() ; display the GUI Do $msg = GUIGetMsg() Select Case $msg = $InstallButton $Checkboxcheck = GUICtrlRead($button1) If $button1 = $GUI_CHECKED Then MsgBox(1, "lol", "checked!") ElseIf $button1 = $GUI_UNCHECKED Then EndIf Case $msg = $InstallButton Case $msg = $ExitID ; MsgBox(0, "You clicked on", "Exit") EndSelect Until $msg = $GUI_EVENT_CLOSE Or $msg = $ExitID How would I check and do things based on the function CreateOption? Thanks, Dennis
Rawox Posted April 28, 2009 Posted April 28, 2009 Try something like: $ReadCheckbox If GUICtrlRead ( $boxname ) = $GUI_CHECKED Then ;code EndIf
flxfxp Posted April 28, 2009 Author Posted April 28, 2009 Nope, doesn't work. Thanks for the fast reply though! Dennis
Hyuna Posted April 28, 2009 Posted April 28, 2009 Anyone else?Thanks,DennisI came up with this:CODE#include <GUIConstantsEx.au3>;how many labels?$labelnumber = 4$windowheight = $labelnumber * 10 + 185$buttonheight = $labelnumber * 10 + 135GUICreate("installr", 130, $windowheight) GUICtrlCreateLabel("What to install?", 10, 10) $firefox = GUICtrlCreateCheckbox("firefox", 15, 30, 97, 17) $winrar = GUICtrlCreateCheckbox("Winrar", 15, 50, 97, 17) $lol = GUICtrlCreateCheckbox("lol", 15, 70, 97, 17) $test2 = GUICtrlCreateCheckbox("test2", 15, 90, 97, 17) $ExitID = GUICtrlCreateButton("Exit", 70, $buttonheight, 50, 20) $InstallButton = GUICtrlCreateButton("Install", 10, $buttonheight, 50, 20) GUICtrlCreateLabel("FLX installr - 2008", 13, $buttonheight + 25) GUISetState() ; display the GUI Do $msg = GUIGetMsg() Select Case $msg = $InstallButton If GUICtrlRead($firefox) = 1 Then MsgBox(0, "lol", "firefox checked!") If GUICtrlRead($winrar) = 1 Then MsgBox(0, "lol", "winrar checked!") If GUICtrlRead($lol) = 1 Then MsgBox(0, "lol", "lol checked!") If GUICtrlRead($test2) = 1 Then MsgBox(0, "lol", "test2 checked!") Case $msg = $InstallButton Case $msg = $ExitID EndSelect Until $msg = $GUI_EVENT_CLOSE Or $msg = $ExitIDWorks fine for me.....Greets, Vincent
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