DustinBowers Posted January 29, 2010 Share Posted January 29, 2010 I have While/Wend loop searching for user input with a Switch statement. My form used a loop to generate 400+/- labels and this case statement evaluates them such as: Case $Label[1] Case $Label[2] is there a better way than typing out 400+/- case statements inside this while loop? The loop: expandcollapse popupWhile 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $BtnAdd If GUICtrlRead($CropComboList) = "" then MsgBox(0, "Error", "You must select a crop from the combo box before adding a seeding area to the list") ElseIf GUICtrlRead($CropComboList) = "Select a Crop" then MsgBox(0, "Error", "You must select a crop from the combo box before adding a seeding area to the list") EndIf GUICtrlSetData($AreaList, "Area " & $AreaCount & ": " & GUICtrlRead($CropComboList)) $AreaCount = $AreaCount + 1 Case $BtnExit Call("Terminate") Case $Label1[1] MsgBox(0,"", "You pushed the Button 1" & $Label1[1]) GUICtrlSetBkColor($Label1[1], $GUI_BKCOLOR_TRANSPARENT) Case $Label1[2] MsgBox(0,"", "You pushed the Button 2" & $Label1[2]) GUICtrlSetBkColor($Label1[2], $GUI_BKCOLOR_TRANSPARENT) Case $Label1[3] MsgBox(0,"", "You pushed the Button 3" & $Label1[3]) GUICtrlSetBkColor($Label1[3], $GUI_BKCOLOR_TRANSPARENT) Case $Label1[4] MsgBox(0,"", "You pushed the Button 4" & $Label1[4]) GUICtrlSetBkColor($Label1[4], $GUI_BKCOLOR_TRANSPARENT) EndSwitch WEnd Link to comment Share on other sites More sharing options...
JohnOne Posted January 29, 2010 Share Posted January 29, 2010 Your Labell[n] looks like an array format so you could loop through it. But perhaps you would be better using GUIOnEventMode option. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
enaiman Posted January 29, 2010 Share Posted January 29, 2010 Dude - you keep asking for help for your bot I guess you simply don't know when to stop. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
DustinBowers Posted January 29, 2010 Author Share Posted January 29, 2010 Not quite sure how to loop through the array where if the user clicks one of the labels the action is triggered ie: user clicks $Label1[250] then GUICtrlDelete($label1[20]) or maybe change color... any further ideas? It would be a great help. Link to comment Share on other sites More sharing options...
JohnOne Posted January 29, 2010 Share Posted January 29, 2010 Well you cant get much user input from a label I dont think, probably just a boolean True or False. Its a little difficult to understand what you are wanting to do. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
DustinBowers Posted January 29, 2010 Author Share Posted January 29, 2010 Well currently, I have 400 labels 1-400, when a user clicks one of the labels it deletes that label and writes a simple ini entry. i dont need any other input from the user besides a click. Link to comment Share on other sites More sharing options...
JohnOne Posted January 29, 2010 Share Posted January 29, 2010 Well you definately need to read up on GUIOnEventMode, and you also want to look at GUICtrlSetOnEvent, to call your iniwrite function. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
DustinBowers Posted January 29, 2010 Author Share Posted January 29, 2010 Thanks for the input. Ill read up on both of those. Link to comment Share on other sites More sharing options...
picea892 Posted January 29, 2010 Share Posted January 29, 2010 Back to the first response. I think you need to use a for next loop for $i=1 to 400 Case $Label1[1] MsgBox(0,"", "You pushed the Button "&$i& $Label1[$i]) GUICtrlSetBkColor($Label1[$i], $GUI_BKCOLOR_TRANSPARENT) Next Link to comment Share on other sites More sharing options...
whim Posted January 29, 2010 Share Posted January 29, 2010 I think you need to use a for next loop Yes, but you'll have to move it outside of the Switch, or it will errorwhim 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