Sign in to follow this  
Followers 0
DemonAngel

Case and Array

4 posts in this topic

I am current generation multiple tabs and controls using for loops and arrays. for example.

while 1
$msg = GuiGetMsg()
Select
Case $msg = $plustabbutton
$tabcount = $tabcount + 1
AddTab($tabcount)
EndSelect   
WEnd

Func AddTab($tabcount)
$tab = GUICtrlCreateTabitem ("Tab "&$tabcount)
$date[$tabcount] = GuiCtrlCreateDate("Date", 170, 120, 130, 20, $DTS_SHORTDATEFORMAT)
Endfunc

Lets say the user clicks the plustabbutton 3 times. This leaves me with $date[1], $date[2] and $date[3].

What I want to know if how to create a case select that inclused the entire array.

Select
Case $msg = $date[*]; If you get what I meen.
EndSelect

bare in mind that Case $msg = $date[1] or $date[2] or $date[3] wont wort since you can end up with 99+ date array entries.

Share this post


Link to post
Share on other sites



When I try the above suggestion I get a "syntax error"

any more ideas?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Don't use the Select Case but just the for next loop.

for $i = 1 to Ubound($date) 
   If  $msg = $date[$i] then
    ;whatever
   EndIf
next
Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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