Jump to content

Close form. and select vs switch


 Share

Recommended Posts

My form wont close if a klik the exit (top right red) button.

local $nMsg , $msg , $Exit
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit       
        Case $msg = $GUI_EVENT_CLOSE or $msg = $Exit                                                ; //If the Exit or Close button is clicked, close the app.
             Exit                                                                                   ; //Exit the Application
        Case $msg = $OPEN_B_1

        Case $msg = $OPEN_B_2

        Case $msg = $OPEN_B_3


    EndSwitch
WEnd

Thanx

Sorry I got the mistake :graduated:

local $nMsg , $Exit
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $nMsg = $GUI_EVENT_CLOSE or $nMsg = $Exit      
             Exit                                                                                   
        Case $nMsg = $OPEN_B_1

        Case $nMsg = $OPEN_B_2

        Case $nMsg= $OPEN_B_3

    EndSwitch
WEnd

but ... still wil not close

Edited by motormad
Link to comment
Share on other sites

local $Msg , $Exit
While 1
    
    $msg = GUIGetMsg()
    Select
        Case 0
            ContinueLoop
        Case $msg = $GUI_EVENT_CLOSE 
            Exit
         Case $Msg = $OPEN_B_1

        Case $Msg = $OPEN_B_2

        Case $Msg= $OPEN_B_3

    Endselect
WEnd

works fine so ill use this.

Probebly a newbie mistake

Link to comment
Share on other sites

Try this.

Local $nMsg , $Exit
While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE, $Exit
            Exit                                                                                   
        Case $OPEN_B_1

        Case $OPEN_B_2

        Case $OPEN_B_3

    EndSwitch
WEnd

Switch tests $nMsg against the value in each Case statement. You can also have multiple values to test listed in the Case statement separated by a comma, which acts like an OR.

Adam

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...