Sign in to follow this  
Followers 0
motormad

Close form. and select vs switch

4 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



The examples in the help file are clear !


AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

Share this post


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

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