Testy Posted March 21, 2008 Posted March 21, 2008 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,
Swift Posted March 21, 2008 Posted March 21, 2008 When you include GUIConstants, make sure in your loop you have: $GUI_EVENT_CLOSE, this means the X was pressed.
Tomb Posted March 21, 2008 Posted March 21, 2008 or you can always do this Opt("GUIOnEventMode", 1) GUISetOnEvent($GUI_EVENT_CLOSE, "_exit") Func _exit() MsgBox(0, "", "Goodbye") Exit EndFunc
PsaltyDS Posted March 21, 2008 Posted March 21, 2008 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
Testy Posted March 21, 2008 Author Posted March 21, 2008 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.
Tomb Posted March 21, 2008 Posted March 21, 2008 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?
PsaltyDS Posted March 21, 2008 Posted March 21, 2008 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
Tomb Posted March 21, 2008 Posted March 21, 2008 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?
PsaltyDS Posted March 21, 2008 Posted March 21, 2008 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
Swift Posted March 21, 2008 Posted March 21, 2008 (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 March 21, 2008 by Swift
Tomb Posted March 21, 2008 Posted March 21, 2008 (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 goodthey 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 Edited March 21, 2008 by Tomb616
PsaltyDS Posted March 21, 2008 Posted March 21, 2008 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
Testy Posted March 21, 2008 Author Posted March 21, 2008 (edited) Show some code!Thank you, I got it. Edited March 21, 2008 by Testy
PsaltyDS Posted March 21, 2008 Posted March 21, 2008 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
Tomb Posted March 21, 2008 Posted March 21, 2008 that is the most buttons i have ever seen in my life.
Testy Posted March 21, 2008 Author Posted March 21, 2008 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now