• 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
NSDocumentController redisplay NSPanel
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSDocumentController redisplay NSPanel


  • Subject: NSDocumentController redisplay NSPanel
  • From: Chris Outwin <email@hidden>
  • Date: Thu, 10 Feb 2005 16:36:08 -0600

I am trying to hide and then redisplay a NSPanel contained in a nib. The panel is lazily allocated via the main menu and displays properly. However after the user closes the one and only panel instance, the document is removed from the document controller. (The panel is owned by a NSWindowController subclass which reports NO to isReleasedWhenClosed in makeWindowControllers.)

The action method is an if/else which allocates the custom NSDocument if the document is nil and redisplays the panel otherwise.

NSDocument* myDocument // In class interface

- (id)sender {

NSDocumentController* dc = [NSDocumentController sharedDocumentController];
if(!myDocument) {
myDocument =[[dc openUntitledDocumentOfType:@"myDocument" display:YES]retain];
}
else {
[myDocument showWindows];
//NSLog now reports zero controllers.
NSLog(@"Upon redisplay of nib, there are %u controllers", [[selfwindowControllers]count]);
}
}


I thought of trying NSWindow's - setReleaseWhenClose, but the docs say it's ignored for windows owned by a controller. But clicking the panel's close button seems to remove the document from the document controller. So the document has been removed from the controller then the above else clause is reached.

How do you retain the panel for redisplay and still have the document controller deallocate the panel when the app closes?


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: container retain/release problem
  • Next by Date: Re: container retain/release problem
  • Previous by thread: Refresh works, but...
  • Next by thread: License server
  • Index(es):
    • Date
    • Thread