Sign in to follow this  
Followers 0
dazza

Return each GUI ctrl

4 posts in this topic

Gurus,

I have a GUI with 100 odd buttons I have created. I need to loop through each one and query the Text on it.

Pseudocode:

For each button on my GUI

;do stuff

Next

Thanks in advance.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I have a GUI with 100 odd buttons I have created. I need to loop through each one and query the Text on it.

I hope you have the button ID's in an array?

If not, put them in there. If the buttons could be auto-created that would be very easy.

Dim $array[100]
For $i = 0 To 99
    $array[$i] = GUICtrlCreateButton("Text", 10, $i * 20, 50, 20)
Next

Then check with:

For $i = 0 To 99
    If GUICtrlRead($array[$i]) = "Text you want to check on" Then
         'do stuff'
    EndIf
Next
Edited by Triblade

My active project(s): A-maze-ing generator (generates a maze)

My archived project(s): Pong3 (Multi-pinger)

Share this post


Link to post
Share on other sites

That'll do it. I'd thought I'd be lazy and avoid that way. But... this way is quicker later on. Ta triblade.

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