Jump to content

Case and Array


Recommended Posts

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.

Link to comment
Share on other sites

  • Developers

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

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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