OnEnd

BlitzMax Forums/BlitzMax Programming/OnEnd

is it new or am I just blind and it's always been there?

- onEnd was always been there
- apptitle is new feature

Do you know if there's a way to halt the ending of BMax app once this is called? (i.e. when someone clicks the X and you want to prevent a close until they confirm).

The OnEnd purpose is not to halt app ending.

Blitz app has no X icon.
There's no event for close icon.

Apparently you need to reestablish the OnEnd when it's been triggered once.
Graphics 640,480,0,0
	
OnEnd(quit)
main()

Function main()

	Repeat
		Cls
		DrawText "Press Escape!",10,10
		Flip
		Delay 100
	Until KeyHit(KEY_ESCAPE)
	
EndFunction

Function quit()

	ret = Proceed("Really quit?")
	If ret<>1
		OnEnd(quit)
		main()
	EndIf

EndFunction


thanks :)
I had kinda figured it out already but I forgot to reset my ended flag and didn't realise you need to reinsert your onEnd function.

I added a modification of your code to the wiki.