Quit Application with Close box on window

My Application doens’t quite when I click on the close box - it just closes the window. How do I get it to quite the application altogther when clicking the close box on the main window?

in interface builder, select the file owner icon, open the inspector window, select applescript from the pulldown, click on the application check box, then select the “on will close” event.

add an on will close to your script.

on will close
	quit
end will close

You could also use this:

on should quit after last window closed theObject
	return true
end should quit after last window closed

cems2, I don’t see an ‘on will close’ handler in Interface Builder.

Brude you’re right, the “will close” event comes from the window not the “application”. So ammend my previous comment to say “click on the Window in interface builder”

This sure doesn’t work, I get an error that the variable “theObject” isn’t defined…

Did you setup the connection properly?

Bruce, I had forgotten that I had attempted something similar on the Window level and it was fighting with the handler you suggested. All’s working now. Thanks again! And thanks to all for the faster server! I can really tell the difference.