Jump to content
Sign in to follow this  
motormad

Close form. and select vs switch

Recommended Posts

motormad

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
wakillon

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
motormad

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

Share this post


Link to post
Share on other sites
AdamUL

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  

×