Jump to content

Checkboxes with variable


Recommended Posts

I haven't seen this posted anywhere and I came across this issue today. I have a page with a list of checkboxes (so far just 4 but it will grow). Now I need to loop thru them and see which ones are checked so i can take action on the checked ones. No big deal if you have a few but I started to make a loop to loop thru $checkbox1 --> $checkbox4 an test if each one was checked or not. The problem i quickly came across was that I can't understand how to create the loop. It's also 2:30 am and I'm fried :whistle:

Many Thanks

Snippet

-------------------------------

$Checkbox_Report1 = GUICtrlCreateCheckbox("PC Description", 20, 50) 
$Checkbox_Report2 = GUICtrlCreateCheckbox("BIOS Info", 20, 75)
$Checkbox_Report3 = GUICtrlCreateCheckbox("Registry Size", 20, 100)
$Checkbox_Report4 = GUICtrlCreateCheckbox("Installed Apps", 20, 125)

=====

Case $msg = $Button_MakeReport
    For $X = 1 to 4
        If BitAnd(GUICtrlRead($Checkbox_Report & $x),$GUI_CHECKED) Then
            msgbox(0,"","checked")
        EndIf
    Next
Edited by dinodod

Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007

Link to comment
Share on other sites

I haven't seen this posted anywhere and I came across this issue today. I have a page with a list of checkboxes (so far just 4 but it will grow). Now I need to loop thru them and see which ones are checked so i can take action on the checked ones. No big deal if you have a few but I started to make a loop to loop thru $checkbox1 --> $checkbox4 an test if each one was checked or not. The problem i quickly came across was that I can't understand how to create the loop. It's also 2:30 am and I'm fried :whistle:

Many Thanks

Snippet

-------------------------------

$Checkbox_Report1 = GUICtrlCreateCheckbox("PC Description", 20, 50) 
$Checkbox_Report2 = GUICtrlCreateCheckbox("BIOS Info", 20, 75)
$Checkbox_Report3 = GUICtrlCreateCheckbox("Registry Size", 20, 100)
$Checkbox_Report4 = GUICtrlCreateCheckbox("Installed Apps", 20, 125)

=====

Case $msg = $Button_MakeReport
    For $X = 1 to 4
        If BitAnd(GUICtrlRead($Checkbox_Report & $x),$GUI_CHECKED) Then
            msgbox(0,"","checked")
        EndIf
    Next
oÝ÷ Ûú®¢×ºÚ"µÍÜ ÌÍÖH ÌÍÐÚXÚØÞÔÜHÈ  ÌÍÐÚXÚØÞÔÜ
Y][
ÕRPÜXY
    ÌÍÖ
K   ÌÍÑÕRWÐÒPÒÑQ
H[ÙÐÞ
    ][ÝÉ][ÝË    ][ÝÐÚXÚÙY  ][ÝÊB^oÝ÷ Ù´â§öÈ*.¦V§¢vv)à±ëÞ­©ç$n^²Ø^§íz»azV¬µÈ^rFèÆëÓ~
Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Woa, now that's pretty sweet! I never would have thought of using the actual checkboxes in the FOR statement. I figured they would either return 1 or 0 if it was checked or not.

How did you learn to do a check like that?

Thank you a million times!

Digital Chaos - Life as we know it today.I'm a Think Tank. Problem is, my tank is empty.The Quieter you are, the more you can HearWhich would you choose - Peace without Freedom or Freedom without Peace?Digital Chaos Macgyver ToolkitCompletely Dynamic MenuSQLIte controlsAD FunctionsEXCEL UDFPC / Software Inventory UDFPC / Software Inventory 2GaFrost's Admin Toolkit - My main competitor :)Virtual SystemsVMWAREMicrosoft Virtual PC 2007

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...