Sign in to follow this  
Followers 0
DustinBowers

Help with Getting User input.

10 posts in this topic

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:

While 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

Share this post


Link to post
Share on other sites



Dude - you keep asking for help for your bot :D

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 :)

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

Thanks for the input. Ill read up on both of those.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 error

whim

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