Re: NSWindowController confusion redux
Re: NSWindowController confusion redux
- Subject: Re: NSWindowController confusion redux
- From: Ken Tozier <email@hidden>
- Date: Tue, 23 May 2006 12:17:00 -0400
On May 23, 2006, at 11:46 AM, Sherm Pendley wrote:
You've missed the mark on some of the details, but I think you have
the right idea. I think the file's owner is a red herring, and a
clue to the problem can be found in that "failed to load window nib
file" message. Figuring out why the nib won't load is key to
solving this.
Thanks Sherm and Mike. Your suggestions gave me a hint and I finally
figured this sucker out.
The nib lives in a rather unusual location and unfortunately I have
no control over that (I'm writing a Quark XTension and Quark puts
their XTensions outside the application bundle) As a consequence, the
normal bundle routines have no idea how to find my nib. I have to
explicitly define the path and use [bundle initWithNibFilePath:] and
that method doesn't come in a non-owner variety.
Looks a bit odd, but here's what works:
// My code is a plugin and the "bundle" here is supplied by the code
that loads me
mainPalettePath = [bundle pathForResource: @"MainPalette"
ofType:@"nib"];
// Allocate the controller
mainPaletteController = [NSWindowController alloc];
// Initialize it with itself as owner
mainPaletteController = [mainPaletteController initWithWindowNibPath:
mainPalettePath owner: mainPaletteController];
// Bingo! We now have a valid window reference
NSLog(@"window = %@", [mainPaletteController window]);
Thanks guys for your help.
Ken
_______________________________________________
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