app terminate and window closing
app terminate and window closing
- Subject: app terminate and window closing
- From: Scot Gellock <email@hidden>
- Date: Fri, 18 Oct 2002 08:01:28 -0700
I have a document based application where each document establishes a
network connection. When the documents are closed, I want to clean up
properly and close each document's open network connection.
I've subclassed NSWindowController and added a windowShouldClose method.
This allows me to handle the document windows close when its closed by the
mouse or from the File menu.
My problem is that I'm having trouble understanding how to handle the
application's quit behavior. Quiting the app doesn't call
windowShouldClose.
I've read "hooking document close" on the archive, and I've gotten as far as
understanding that I can be notified about app termination through the
NSApp's delegate applicationShouldTerminate. Where I'm getting confused is
understanding which object should implement this method and act as the app's
delegate.
Should I be subclassing NSDocumentController, since its the default app
delegate, have the subclass implement applicationShouldTerminate, which in
turn loops through the documents array, calling performClose on each
document's window controller?
Is this the proper way to ensure dirty and non-dirty document windows's
close code gets executed in an application quit scenario?
Scot
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.