Re: NIB Problem
Re: NIB Problem
- Subject: Re: NIB Problem
- From: Christoph Vonrhein <email@hidden>
- Date: Sat, 3 Mar 2007 00:59:26 +0100
Hi,
thanks for the help. It works!
I've used CFBundleGetBundleWithIdentifier (CFSTR("My bundle
identifier")) and it worked instantly. The only "drawback" compared
to Paul's method is, that I need to enter the bundle identifier
manually, instead of asking the system for it. But that's ok with me.
The identifier won't change anyway.
The "bundle" structure of OSX is still a little new to me, which was
my problem in this case. But I'm learning more each and every day.
Christoph
On Mar 3, 2007, at 12:28 AM, Darrin Cardani wrote:
Note that NSBundles are not toll-free bridged with CFBundleRefs, so
you probably want to use CFBundleGetBundleWithIdentifier (CFSTR
("Your bundle identifier")) if you're going to use other Carbon calls.
Darrin
On Mar 2, 2007, at 3:13 PM, Paul Schneider wrote:
Hi, Christoph,
the "main" bundle will be the host application bundle, not your
plugin bundle. You can get your plugin bundle like this:
NSBundle* bundle = [NSBundle bundleForClass:[self class]];
HTH,
- Paul
On Mar 2, 2007, at 5:18 PM, Christoph Vonrhein wrote:
Hello Darrin, hello Dave, hello Apple.
I am trying to open a simple window from within a FxPlug in order
to display some data in it. I currently try it like this (in the
initWithAPIManager method):
CFBundleRef bundleRef;
IBNibRef nibRef;
OSStatus err;
bundleRef = CFBundleGetMainBundle();
err = CreateNibReferenceWithCFBundle(bundleRef,CFSTR
("NibWindow"), &nibRef);
require_noerr (err, CantGetNibRef);
err = CreateWindowFromNib(nibRef, CFSTR("Window"), &window);
require_noerr (err, CantCreateWindow);
DisposeNibReference(nibRef);
cocoaFromCarbonWin = [[NSWindow alloc]
initWithWindowRef:window];
[cocoaFromCarbonWin makeKeyAndOrderFront:nil];
CantCreateWindow:
CantGetNibRef:
The Nib-file is called NibWindow.nib and it contains just a
Window object. It is placed in the English.lproj folder and in
the XCode project in the Resources folder. I also have
AppKit.framework, Foundation.framework, Cocoa.framework and
Carbon.framework loaded.
The CreateNibReferenceWithCFBundle method always gives me the
error -10960 (kIBCarbonRuntimeCantFindNibFile), even though the
nib file exists.
Just for the heck of it, I once tried it with the MainMenu.nib
file from the CarbonCocoaTempConverter (http://
developer.apple.com/samplecode/CarbonCocoaTempConverter/
index.html). That nib file was loaded (no error), but the
CreateWindowFromNib method failed with error "-10", which an
error number that is not even listed in Apples doc files.
Is there something special regarding FxPlug and NIB files I did
not see so far that I have to take note off ?
_
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Pro-apps-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden