Jump to content
Sign in to follow this  
Swimming_Bird

Case structure for any array item of checkboxes

Recommended Posts

Swimming_Bird

I'd like to do :

Case $msg = $array[all]

is there any way to do such a thing?

bascially i have a bunch of checkboxes set up as an array and i want it so that whenever i check or uncheck this box it'll disable/enable a control.

I cant think of any way to do this but brute force.

Thanks

Share this post


Link to post
Share on other sites
MHz

Nothing prevents you from using a For loop in a message loop to test the array. Have it outside of your Select Case block.

Share this post


Link to post
Share on other sites
Swimming_Bird

what do you mean by message loop?

Share this post


Link to post
Share on other sites
MHz

A loop that uses GuiGetMsg to retrieve messages from the Gui.

Only problem that you may incur for testing a large array in a constant loop is CPU usage perhaps being high, but that can be judged upon testing the script.

Edit:

An example

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = -3
            Exit
        Case $msg = <= 0
            ContinueLoop
    EndSelect
    For $i = 0 To UBound($array)-1
        If $msg = $array[$i] Then
            ; do the action
        EndIf
    Next
WEnd
Edited by MHz

Share this post


Link to post
Share on other sites
Swimming_Bird

Case $msg >= $array[0] And $msg <= $array[uBound($array)-1]

You are truely a god among men my good friend.

Worked great thanks.

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  

×