• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Handling close with multiple document windows
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Handling close with multiple document windows


  • Subject: Re: Handling close with multiple document windows
  • From: Mike Abdullah <email@hidden>
  • Date: Tue, 08 Sep 2015 22:52:28 +0100

> On 8 Sep 2015, at 22:40, David Durkee <email@hidden> wrote:
>
> 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.

Sounds to me like you want to set .shouldCloseDocument on one of your window controllers.


_______________________________________________

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


References: 
 >Handling close with multiple document windows (From: David Durkee <email@hidden>)

  • Prev by Date: Re: Handling close with multiple document windows
  • Next by Date: Re: Swift generics, circular type declarations, and segfaults, oh my!
  • Previous by thread: Re: Handling close with multiple document windows
  • Next by thread: NSURLSessionUploadTask and resuming
  • Index(es):
    • Date
    • Thread