azure Posted August 12, 2004 Share Posted August 12, 2004 Here's a scenario. I put the variable handles for a bunch of GUI controls into an array. Such as: Dim $control[8][3] Dim $labels[8][3] $temparray = '' $temparray = stringsplit('Sunday,Monday,Tuesday,Wednsday,Thursday,Friday,Saturday',',') For $i = 1 To $temparray[0] $labels[$i-1][0] = $temparray[$i] Next $temparray = '' $temparray = stringsplit('Sunday,Monday,Tuesday,Wednsday,Thursday,Friday,Saturday',',') For $i = 1 To $temparray[0] $labels[$i-1][1] = $temparray[$i] Next $temparray = '' $temparray = stringsplit('Sunday,Monday,Tuesday,Wednsday,Thursday,Friday,Saturday',',') For $i = 1 To $temparray[0] $labels[$i-1][2] = $temparray[$i] Next $tabgroup = GUISetControl("tab", "Tab Group", 10, 10, 180, 180) For $i = 0 To UBound ( $control, 0 ) $control[$i][0] = GUISetControl("tabitem", $labels[$i][0], 0, 0, 0, 0) $control[$i][1] = GUISetControl("progress", $labels[$i][1], 100, 40, 50, 140) $control[$i][2] = GUISetControl("edit", $labels[$i][2], 20, 40, 80, 140) Next $tabclose = GUISetControl("tabitem","",-99,-99,1,1) How would I write a select block to check if the GUIMsg = a variable stored in, say another array. (using a for/ubound loop perhaps?) I could save tons of lines of code and make it much more dynamic than having to define every single case! Link to comment Share on other sites More sharing options...
pekster Posted August 12, 2004 Share Posted August 12, 2004 (edited) Use this kind of construct:Select Case Test1() ;do stuff Case Test2() ;do other stuff ;etc etc etc EndSelect Func Test1() Local $count For $count = 0 To 5 If $global_array[$count] = 1 Then return 1 Next return 0 EndFunc Func Test2() Local $count For $count = 6 To 10 If $global_array[$count] = 1 Then return 1 Next return 0 EndFuncYou'll notice that the functions that define the text can be as complex as you need them to, and access multipile variables, arrays, whatever. The return of that function will make up the true or false value that the Select... Case construct uses to determine which branch of your code to run.Minor code edit Edited August 12, 2004 by pekster [font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now