site_archiver@lists.apple.com Delivered-To: pro-apps-dev@lists.apple.com Hi, thanks for the help. It works! Christoph On Mar 3, 2007, at 12:28 AM, Darrin Cardani wrote: Darrin On Mar 2, 2007, at 3:13 PM, Paul Schneider wrote: Hi, Christoph, 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. CFBundleRef bundleRef; IBNibRef nibRef; OSStatus err; err = CreateWindowFromNib(nibRef, CFSTR("Window"), &window); require_noerr (err, CantCreateWindow); DisposeNibReference(nibRef); [cocoaFromCarbonWin makeKeyAndOrderFront:nil]; CantCreateWindow: CantGetNibRef: _______________________________________________ Do not post admin requests to the list. They will be ignored. Pro-apps-dev mailing list (Pro-apps-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/pro-apps-dev/site_archiver%40lists.ap... 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. 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. the "main" bundle will be the host application bundle, not your plugin bundle. You can get your plugin bundle like this: 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): bundleRef = CFBundleGetMainBundle(); err = CreateNibReferenceWithCFBundle(bundleRef,CFSTR ("NibWindow"), &nibRef); require_noerr (err, CantGetNibRef); cocoaFromCarbonWin = [[NSWindow alloc] initWithWindowRef:window]; 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 ? _ This email sent to site_archiver@lists.apple.com
participants (1)
-
Christoph Vonrhein