Jump to content

Recommended Posts

Posted

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,

Posted

When you include GUIConstants, make sure in your loop you have: $GUI_EVENT_CLOSE, this means the X was pressed.

Posted

or you can always do this

Opt("GUIOnEventMode", 1)
GUISetOnEvent($GUI_EVENT_CLOSE, "_exit")

Func _exit()
MsgBox(0, "", "Goodbye")
Exit
EndFunc
Posted

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
Posted

I must have something going on in my script, or do not have the proper placement for the examples posted. None of them allowed the x buttom on the window to work/close it.

Posted

I must have something going on in my script, or do not have the proper placement for the examples posted. None of them allowed the x buttom on the window to work/close it.

even mine?

:)

Posted

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
Posted

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?

:)

Posted

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
Posted (edited)

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
Posted (edited)

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
Posted

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
Posted

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.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...