Re: Completely remove a window (from NSApp)?
Re: Completely remove a window (from NSApp)?
- Subject: Re: Completely remove a window (from NSApp)?
- From: Matt Neuburg <email@hidden>
- Date: Wed, 27 Dec 2006 15:41:49 -0800
- Thread-topic: Completely remove a window (from NSApp)?
On Wed, 27 Dec 2006 14:56:02 -0800, Jerry Krinock <email@hidden> said:
>I understand that NSApp maintains the "master list" of references to all the
>app's windows, which it returns a copy of in response to -[NSApp windows].
>So, it seems like NSApp should have a -removeWindow: method in order to
>remove them, but it does not.
>
>So, how do I completely remove a window?
>
>Thanks!
>
>Jerry Krinock
>
>
>Why I'm asking this: This app is sort-of document-based. My documents are
>subclasses of NSDocument, but I've over-ridden a lot of stuff to get special
>behavior, and presently I need to remove a window as part of "Don't Save".
>
>By the way, I can't find any documentation on how a window gets added to
>that "master list" in NSApp either. It seems to be by magic!
It isn't entirely clear what you want to do.
If you're concerned about the Window list shown in the Window menu, you can
control that with NSApplication's removeWindowsItem and NSWindow's
setExcludedFromWindowsMenu. Once a window is no longer listed in the Window
menu, the user can't summon it or hear about it - to all intents and
purposes, it is gone (unless *you* summon in code).
So what more do you want?
If you are concerned about the memory used by a window, use
setReleasedWhenClosed, or employ the nib architecture (esp. with
NSWindowController, though that is not absolutely necessary). m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>
_______________________________________________
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