Jump to content

BUTTON ISSUES


Slvrngrn
 Share

Recommended Posts

OK, super-n00b here...

The code I have below is supposed to monitor my GUI. Obviously shut down the program if the GUI is exited, but I also want it to verify that a combobox selection has been made prior to moving on from the GUI. When I run it though I repeatedly get the MsgBox telling you to pick a crop. As soon as you close one box another pops up instantly. I tried $Button = 0 and $Button = False in the hopes that that would reset the button to the "unpressed" state. Is there a way to accomplish this so that once the MsgBox is closed the GUI will be "refreshed"? Or am I going about this completely wrong?

Thanks for your help and patience...

While $a = 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                Exit
            Case $Button1
                $CropF = GUICtrlRead($Crop)
                If $CropF = "Select a crop..." Then
                    MsgBox(0, "Pick a crop", "You must select a crop to harvest.")
                    $a = 1
                    $Button1 = False
                Else
                    $a = $a - 1
                EndIf
        EndSwitch
    WEnd
Link to comment
Share on other sites

First of all, does this work better ? (as a first step)

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $GUI_EVENT_CLOSE
                Exit
            Case $Button1
                $CropF = GUICtrlRead($Crop)
                If $CropF = "Select a crop..." Then
                    MsgBox(0, "Pick a crop", "You must select a crop to harvest.")
                EndIf
        EndSwitch
WEnd
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...