Jump to content

Window will not close with the X


 Share

Recommended Posts

Hi all,

The script that I created, will not close the window with the X. I had to create an exit button.

Is there a quick fix? Still learning.

I love my script. I'm just getting heckled by people...

Thank you,

Link to comment
Share on other sites

Swift gave you a good answer, but I love a quickie demo:

#include <GuiConstants.au3>

$hGUI = GUICreate("Test", 200, 200)
$Button = GUICtrlCreateButton("OK", 20, 20, 160, 160)
GUISetState()

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button
            MsgBox(64, "OK", "OK")
    EndSwitch
WEnd

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

even mine?

:)

The only problem with yours was it is incomplete. I personally prefer event mode for my GUIs, but message mode is easier to start out with.

#include <GuiConstants.au3>

Opt("GuiOnEventMode", 1)

$hGUI = GUICreate("Test", 200, 200)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit")
$Button = GUICtrlCreateButton("OK", 20, 20, 160, 160)
GUICtrlSetOnEvent(-1, "_ButtonHit")
GUISetState()

While 1
    Sleep(20)
WEnd

Func _Quit()
    Exit
EndFunc

Func _ButtonHit()
    MsgBox(64, "OK", "OK")
EndFunc

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

The only problem with yours was it is incomplete. I personally prefer event mode for my GUIs, but message mode is easier to start out with.

#include <GuiConstants.au3>

Opt("GuiOnEventMode", 1)

$hGUI = GUICreate("Test", 200, 200)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit")
$Button = GUICtrlCreateButton("OK", 20, 20, 160, 160)
GUICtrlSetOnEvent(-1, "_ButtonHit")
GUISetState()

While 1
    Sleep(20)
WEnd

Func _Quit()
    Exit
EndFunc

Func _ButtonHit()
    MsgBox(64, "OK", "OK")
EndFunc

:)

incomplete eh?

just because i posted an example instead of full code?

:)

Link to comment
Share on other sites

incomplete eh?

just because i posted an example instead of full code?

:)

Just a personal thang... I prefer fully self-contained demo scripts that can be run as posted. There was nothing wrong with your example, I just prefer a running demo. Some kind of OCD problem I have. :)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Just a personal thang... I prefer fully self-contained demo scripts that can be run as posted. There was nothing wrong with your example, I just prefer a running demo. Some kind of OCD problem I have. :)

If answers are which you seek.

Seek Here.

Edited by Swift
Link to comment
Share on other sites

Just a personal thang... I prefer fully self-contained demo scripts that can be run as posted. There was nothing wrong with your example, I just prefer a running demo. Some kind of OCD problem I have. :)

ah i see.

is good

they can run the example, and then they grasp concept of how it works.

:)

Edit:

If answers are which you seek.

Seek Here...............

OH MY GOD!

i found every answer i need there

:party:

Edited by Tomb616
Link to comment
Share on other sites

If answers are which you seek.

Seek Here.

No, no! They're HERE!

A few hours of zen-like meditation on that site will reveal all...

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

OK Here goes... You have been warned.

You were not paying attention to the answers you already got. All you needed was this:
While 1

    ; ...

        Case $Button7r7
            Run("C:\Abel_Thin\jade.exe appServer=44.55.61.16 appServerPort=" & $port & "")
            login()

        Case $GUI_EVENT_CLOSE
            _Exit()

        Case $Exit
            _Exit()

    EndSwitch
WEnd

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

You were not paying attention to the answers you already got. All you needed was this:

While 1

    ; ...

        Case $Button7r7
            Run("C:\Abel_Thin\jade.exe appServer=44.55.61.16 appServerPort=" & $port & "")
            login()

        Case $GUI_EVENT_CLOSE
            _Exit()

        Case $Exit
            _Exit()

    EndSwitch
WEnd

:)

I got it, your reply jogged it, and I got the context, it didn't work at first then it clicked. Than you all.

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