• 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
Handling close with multiple document windows
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Handling close with multiple document windows
      • From: Mike Abdullah <email@hidden>
    • Re: Handling close with multiple document windows
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: Arrow Keys in NSSlider
  • Next by Date: Re: Swift generics, circular type declarations, and segfaults, oh my!
  • Previous by thread: Re: Arrow Keys in NSSlider
  • Next by thread: Re: Handling close with multiple document windows
  • Index(es):
    • Date
    • Thread