Re: NSPanel nib with NSWindowController
Re: NSPanel nib with NSWindowController
- Subject: Re: NSPanel nib with NSWindowController
- From: Bill Cheeseman <email@hidden>
- Date: Thu, 14 Aug 2003 13:52:16 -0400
on 03-08-14 1:09 PM, Chuck Soper at email@hidden wrote:
>
Can I have a nib that contains a panel (with no window) whose File's
>
Owner is a NSWindowController subclass?
I do it all the time.
NSPanel is a subclass of NSWindow, so whatever works for windows works for
panels, plus some.
I take a different approach than yours, though. I don't see anything in your
example that indicates you have allocated and initialized the panel's window
controller, which may be your problem.
My menu item's action method allocates and initializes the panel's
NSWindowController subclass, like so:
[[MyPanelController alloc] init];
Then my action method does a couple of other things, like assigning the
newly allocated controller to an instance variable where the rest of my app
can get at it, and calling a couple of methods of the newly allocated
controller to set its own instance variables to objects in my main app that
the controller needs access to.
Finally, my action method forces the panel (window) to load and display,
like so:
[[self myPanelController] window];
[[self myPanelController] showWindow:sender];
(You may not need both of these messages. I've left out some irrelevant
detail that makes it necessary in my app.)
I call -initwithWindowNibName: in my panel controller's -init method, so it
gets called when I allocate and init my panel controller in the action
method.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
The AppleScript Sourcebook -
http://www.AppleScriptSourcebook.com
Vermont Recipes -
http://www.stepwise.com/Articles/VermontRecipes
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.