Handling close with multiple document windows
Handling close with multiple document windows
- Subject: Handling close with multiple document windows
- From: David Durkee <email@hidden>
- Date: Tue, 08 Sep 2015 16:40:28 -0500
I have a document-based application where the documents have a second window, which is used for editing a color list for the document. Originally I just conceived this as a modeless dialog, but recently I wanted to make the document able to handle the Undo command when this window has focus. To do this, I make it a second document window by calling the document’s addWindowController method.
This had the side effect of the document not closing or trying to save until both the main document window and the color list window were closed by the user. The color list window is still a secondary window, so I want to treat closing of the main window as a request to close the document. The first thing I tried was adding a windowWillClose window delegate method to the document for the main window, and inside that method, close the secondary window.
Unfortunately I discovered that, if both windows are open, closing the main one now closes both without trying to save the document, resulting in data loss.
I haven’t been able to find a way to make trying to close the main window try to close the document even if the secondary window is open.
David
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden