• 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
NSPanel nib with NSWindowController
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSPanel nib with NSWindowController


  • Subject: NSPanel nib with NSWindowController
  • From: Chuck Soper <email@hidden>
  • Date: Thu, 14 Aug 2003 10:09:17 -0700

Can I have a nib that contains a panel (with no window) whose File's
Owner is a NSWindowController subclass?

Whenever I add a new application-based window (that has a fair amount
of GUI) to my application, I put it in its own nib file and make the
File's Owner a custom subclass of NSWindowController. This works
great. Now I want to do the same thing, but with an NSPanel.

When I select the menu item that should show the info panel the
action method from my application's controller (code is below) gets
called. The nib is loaded but the window is nil. How can I get the
panel to show when the menu item is selected?

Can I get this to work properly by adding an outlet to my window
controller that contains a reference to my panel then make it the
controller's window? To do this I would add the following line after
allocating the controller:
[myInfoController setWindow:[myInfoController myInfoPanel]];

Will this approach work or is it not recommended? Or should I use a
regular controller object (NSObject subclass) instead of an
NSWindowController?
Thanks, Chuck

- (IBAction)showInfoWindow:(id)sender
{
if (myInfoController == nil)
{
myInfoController = [[InfoController alloc]
initWithWindowNibName:@"Info"];
}

//[myInfoController windowNibName] is correct.
//[myInfoController window] is nil here.

// (Attempt to) Show the window via the controller.
[myInfoController showWindow:self];
}
_______________________________________________
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.

  • Follow-Ups:
    • Re: NSPanel nib with NSWindowController
      • From: Bill Cheeseman <email@hidden>
    • Re: NSPanel nib with NSWindowController
      • From: publiclook <email@hidden>
  • Prev by Date: Re: Strange outline view display behavior
  • Next by Date: Re: Tons of fun w/NSComboBox
  • Previous by thread: Re: Strange outline view display behavior
  • Next by thread: Re: NSPanel nib with NSWindowController
  • Index(es):
    • Date
    • Thread