Sign in to follow this  
Followers 0
JLC123

Conditional help please

3 posts in this topic

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Thanks!


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

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