• 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: Completely remove a window (from NSApp)?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Completely remove a window (from NSApp)?


  • Subject: Re: Completely remove a window (from NSApp)?
  • From: PGM <email@hidden>
  • Date: Wed, 27 Dec 2006 21:59:46 -0500

But indeed, if I -setReleasedWhenClosed:YES, and then -close a window, it is
instantly removed from -[NSApp windows]. So, apparently
-setReleasedWhenClosed is the magic behind NSApp removing a document; a more
accurate name would be -removeFromNSAppWhenClosed. But I'm fine with magic
as long as it works :) This works in an NSWindowController category or
subclass:

I made a little test-project and it seems that the magic is not so much in -setReleasedWhenClosed itself, but simply in releasing the instance of NSWindow. As soon as a window is initialised, it will show up in [NSApp windows] even if it is doing nothing but sitting unused in a nib file and is never actually shown. The window will only disappear from NSApp's list once it is released. So your - removeWindow method will not work unless you are sure that the window is not retained elsewhere.


If I recall correctly, for document windows normally NSWindowController takes care of releasing the window it manages, so that when a NSDocument instance releases its windowControllers, the windowControllers release their windows. So you probably hacked your NSDocument subclass in such a way that this does not happen anymore.

Cheers, Patrick
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: 
 >Re: Completely remove a window (from NSApp)? (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Re: changing cell controls in an NSOutlineView
  • Next by Date: How can I get the HDD serial number with paritition identification no like disk1s0
  • Previous by thread: Re: Completely remove a window (from NSApp)?
  • Next by thread: [Meeting] Toronto Area Cocoa and WebObjects Developer Group - January 9, 2007
  • Index(es):
    • Date
    • Thread