Jump to content

Conditional help please


JLC123
 Share

Recommended Posts

MyGUI has 1 checkbox and 2 input boxes - I need to make sure that all three have data before running the script. I know this is probably unbearably basic coding, so forgive me for asking but . . .

Can anyone fix my check input section please?

While 1
   
   $msg = GUIGetMsg()
   
   If $msg = $GUI_EVENT_CLOSE Then ExitLoop
   
   Select
   Case $msg = $byebutton; Exit
         Exit
   Case $msg = $FirstButton; Select
         If GUICtrlRead($FirstButton) = $GUI_CHECKED Then
            GUICtrlSetState($SecondButton, $GUI_DISABLE)
            $item_checked = 1
         Else
            GUICtrlSetState($SecondButton, $GUI_ENABLE)
        EndIf
    Case $msg = $SecondButton; Select
         If GUICtrlRead($SecondButton) = $GUI_CHECKED Then
            GUICtrlSetState($FirstButton, $GUI_DISABLE)
            $item_checked = 1
         Else
            GUICtrlSetState($FirstButton, $GUI_ENABLE)
        EndIf
    Case $msg = $okbutton; GO!
;Check for input
        If $item_checked = 0 Then
            MsgBox(16, "ERROR", "Please Select Check Box")
        EndIf   
        If GUICtrlRead($Check1) = 0 Then
            MsgBox(16, "ERROR", "Please Enter #1 Input")
        EndIf
        If GUICtrlRead($Check2) = 0 Then
            MsgBox(16, "ERROR", "Please Enter #2 Input")
        Else
            Get_Data()
        EndIf
EndSelect
WEnd

Two wrongs don't make a right, but three lefts do

Link to comment
Share on other sites

While 1
   
   $msg = GUIGetMsg()
   
   If $msg = $GUI_EVENT_CLOSE Then ExitLoop
   
   Select
   Case $msg = $byebutton; Exit
         Exit
   Case $msg = $FirstButton; Select
         If GUICtrlRead($FirstButton) = $GUI_CHECKED Then
            GUICtrlSetState($SecondButton, $GUI_DISABLE)
            $item_checked = 1
         Else
            GUICtrlSetState($SecondButton, $GUI_ENABLE)
            $item_checked = 0
        EndIf
    Case $msg = $SecondButton; Select
         If GUICtrlRead($SecondButton) = $GUI_CHECKED Then
            GUICtrlSetState($FirstButton, $GUI_DISABLE)
            $item_checked = 1
         Else
            GUICtrlSetState($FirstButton, $GUI_ENABLE)
            $item_checked = 0
        EndIf
    Case $msg = $okbutton; GO!
;Check for input
        If $item_checked = 0 Then
            MsgBox(16, "ERROR", "Please Select Check Box")
            ContinueLoop
        EndIf    
        If GUICtrlRead($Check1) = 0 Then
            MsgBox(16, "ERROR", "Please Enter #1 Input")
            ContinueLoop
        EndIf
        If GUICtrlRead($Check2) = 0 Then
            MsgBox(16, "ERROR", "Please Enter #2 Input")
            ContinueLoop
        EndIf
        Get_Data()
    EndSelect
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...