Re: Open Window from Input Manager
Re: Open Window from Input Manager
- Subject: Re: Open Window from Input Manager
- From: Daniel <email@hidden>
- Date: Wed, 29 Oct 2008 17:16:26 +0100
I finally got it! :-)
<snippet>
NSBundle *bundle = [NSBundle bundleWithIdentifier: @"org.x616c.LMC"];
NSWindowController *controller = [[NSWindowController alloc]
initWithWindowNibPath: [NSString
stringWithFormat:@"%@/Contents/Resources/Chooser.nib", [bundle
bundlePath]] owner: self];
[controller showWindow:self];
</snippet>
thank all for the help!
Daniel
On Wed, Oct 29, 2008 at 4:25 PM, Michael Ash <email@hidden> wrote:
> On Wed, Oct 29, 2008 at 9:29 AM, Daniel <email@hidden> wrote:
>> Hi,
>>
>> thank you for your reply.
>>
>> Does this mean that I'm trying to loading a NIB file from the bundle
>> of the running application (in which the input manager has been
>> loaded)?
>>
>> NSBundle *bundle = [NSBundle bundleWithIdentifier: @"org.x616c.LMC"];
>>
>> I've found out how to find the right bundle, but I'm still stuck in
>> trying to load a window from a NIB file inside my bundle ... can
>> someone help me?
>
> Your last post indicated an NSWindowController being used to load the
> nib. I am not 100% sure on this (please post your code when you have
> question!) but that's how it appeared.
>
> If so, then you should be able to get things working by using a custom
> subclass of NSWindowController that's in your bundle.
> NSWindowController is, I think, smart enough to look in the same
> bundle as the class of the object doing the loading.
>
> Failing that, rather than using -initWithWindowNibName:, use
> -initWithWindowNibPath:owner: which allows you to specify a full path.
> NSBundle can get you a full path for any resource file.
>
> If you want to load the nib manually (not recommended, always use
> NSWindowController or NSViewController to load nibs) then you can use
> the NSNib class, or one of the NSBundle extensions in NSNibLoading.h.
>
> Mike
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please 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
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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