Sign in to follow this  
Followers 0
dvlkn

Looping through controls

2 posts in this topic

#1 ·  Posted (edited)

Hi

Can anyone show me how to perform looping through controls (check boxes in this case) ? I know that the code in visual basic is something like:

Dim I As Integer

For I = 1 To 4
Me.Controls("Checkbox" & I).Value = True
Next

But how to do it in autoIT ?

Edited by dvlkn

Share this post


Link to post
Share on other sites



Hi

Can anyone show me how to perform looping through controls (check boxes in this case) ? I know that the code in visual basic is something like:

Dim I As Integer

For I = 1 To 4
Me.Controls("Checkbox" & I).Value = True
Next

But how to do it in autoIT ?

This is one way to do it.

Hope it helps.

You are going to have to get to know the help file intimately.

; Modified Example of GUICtrlCreateCheckbox Function from Help 
#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Example()

Func Example()
    Local $checkCN[5], $msg, $I
    GUICreate("My GUI Checkbox")  ; will create a dialog box that when displayed is centered
    GUISetState()
    
    For $I = 1 To 4    
        $checkCN[$I] = GUICtrlCreateCheckbox("CHECKBOX " & $I, 10, 10+($I*23), 120, 20)
        GUICtrlSetState($checkCN[$I],$GUI_CHECKED)
    Next
    
    GUICtrlSetState($checkCN[2],$GUI_UNCHECKED)          

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0