fraudh8er Posted July 1, 2004 Posted July 1, 2004 (edited) I meant Checkbox problem, sorry about that. THere is somthing i want to do but I am some trouble making it work. I have the basic GUI made, thanks to the autobuilder. All I want to do is take the input from a checkbox and run functions accordingly. For example; lets say I have four checkbox's which all correspond to four functions. the user checks the box's presses the start button at the bottom of the gui. Lets say the user checks box 1 and 4, functions 1 and 4 will run when the start button is pressed. I have been looking at some examples and cant seem to get a grasp on this concept. I little help would be nice, I dont mind learning and/or torubleshooting, but I am really stuck. thank you. Edited July 1, 2004 by fraudh8er
CyberSlug Posted July 1, 2004 Posted July 1, 2004 When the button is clicked, read the state of each checkbox and act accordingly. Example: Global $GUI_CHECKED = 1 Global $GUI_INDETERMINATE = 2 Global $GUI_UNCHECKED = 4 Opt("GUINotifyMode", 1) GuiCreate("MyGUI", 392,273,(@DesktopWidth-392)/2, (@DesktopHeight-273)/2 , 0x04CF0000) $checkbox_1 = GUISetControl("checkbox", "Checkbox 1", 20, 20, 130, 30) $checkbox_2 = GUISetControl("checkbox", "Checkbox 2", 20, 60, 130, 30) $checkbox_3 = GUISetControl("checkbox", "Checkbox 3", 20, 100, 130, 40) $checkbox_4 = GUISetControl("checkbox", "Checkbox 4", 20, 150, 130, 30) $button_1 = GUISetControl("button", "Button 1", 20, 200, 130, 50) GuiShow() While 1 sleep(100) $msg = GuiMsg(0) Select Case $msg = -3 Exit Case $msg = $button_1 If GuiRead($checkbox_1) = $GUI_CHECKED Then MsgBox(4096,"","Checkbox #1 is checked") If GuiRead($checkbox_2) = $GUI_CHECKED Then MsgBox(4096,"","Checkbox #2 is checked") If GuiRead($checkbox_3) = $GUI_CHECKED Then MsgBox(4096,"","Checkbox #3 is checked") If GuiRead($checkbox_4) = $GUI_CHECKED Then MsgBox(4096,"","Checkbox #4 is checked") EndSelect WEnd Exit Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Arctor Posted July 1, 2004 Posted July 1, 2004 You can get the state of a checkbox (and other controls) with GuiRead() FileChangeDir(@ScriptDir) GUICreate("Title", 200, 200) $check_1 = GuiSetControl ("checkbox", "", 10,10,20,20) $check_2 = GuiSetControl ("checkbox", "", 10,30,20,20) $check_3 = GuiSetControl ("checkbox", "", 10,50,20,20) $check_4 = GuiSetControl ("checkbox", "", 10,70,20,20) $OK = GUISetControl ("button", "OK", 10,100,100,20) GuiSetControlNotify() ;------------------------------------------------- GuiShow() While GUIMsg() <> -3 $msg = GuiRead() Select case $msg = $OK $val_check_1 = GuiRead($check_1) $val_check_2 = GuiRead($check_2) $val_check_3 = GuiRead($check_3) $val_check_4 = GuiRead($check_4) ;---Just to see what you get back--- ;---1 is checked, 4 is unchecked, exactly what the helpfile says--- MsgBox (0, "title", $val_check_1 & $val_check_2 & $val_check_3 & $val_check_4) ;---So you can do things like--- IF $val_check_1 == 1 Then MsgBox (0, "Output", "Checkbox 1 is checked") Else MsgBox (0, "Output", "Checkbox 1 is unchecked") EndIf EndSelect Wend arctor
CyberSlug Posted July 1, 2004 Posted July 1, 2004 Hi Cyber. Same time same place Maybe I was able to post <= 1 minute faster since I used http://www.autoitscript.com/fileman/users/public/CyberSlug/MoreCode.html Or because I didn't comment my code Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
fraudh8er Posted July 1, 2004 Author Posted July 1, 2004 You guys rock, I will let you know how it goes and keep you guys updates.
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