Window closed using the X

BlitzMax Forums/BlitzMax Beginners Area/Window closed using the X

Aymes(Posted 2006) [#1]
How do I get Bmax to run a function if someone closes the window with the X.

Ive tried onEnd which only works if the program is exited normally.

Im guessing its some kind of event thing, which im not really clued up on...

Any ideas?


klepto2(Posted 2006) [#2]
IF you mean A MAxGUI App, then this should do it:

Local Window:TGadget = CreateWindow("Test",20,20,600,400)


Repeat

WaitEvent()

Print CurrentEvent.ToString()

	Select EventID()
		Case EVENT_WINDOWCLOSE
			If Confirm("Really Quit ?") = True Then End		
	End Select

Forever


If you mean a normal Graphics App then look at :
http://www.blitzbasic.com/Community/posts.php?topic=56183


Aymes(Posted 2006) [#3]
cheers for that klepto! appterminate was what i was looking for :)