On Jul 13, 2008, at 9:25 PM, Jim Crafton wrote:
Can you elaborate on why? Most of the time from what I've seen, when
people think they need to do this, they really don't. For example:
Sure, I'm porting a framework over to OS X. The framework (in C++),
doesn't use NIBs, but does (obviously) use menu items and thus I need
to be able to populate the menu bar. I had figured populating it
programmatically wouldn't be this difficult. The framework libs will
exist as OS X Frameworks, and I wasn't sure if I can have nib's in the
Framework binary. Everything else in Cocoa seems relatively
straightforward, I'm not sure why menus are such a big deal.

Your application's menu isn't that big of a deal, but your application's integration with Mac OS X is a very big deal and that is most of the battle of doing "nib less" development. It is much more than just populating the main menu. Specifically, the application wrapper -- the .app -- typically contains all kinds of metadata that is used by Mac OS X to integrate the application into the system, both from the Finder's perspective and when the application is run.

How do you bootstrap the framework? I.e. what executable is run that uses the resources from the framework? That is the most likely place to stick the MainMenu.nib and let Cocoa bootstrap the normal way.

- People implementing a framework that needs to create everything
programmatically. Instead of going without a nib, create a stub
MainMenu.nib which contains as little as possible but still gets your
program up and running. At that point you can then customize the menu
and everything else in code.

This is my case. I'll try and look into that. Any examples like this
around (keeping in mind that this eventually has to exist inside of a
Framework as opposed to an app)?

Sure. Create a new Cocoa Application project in Xcode. That is about the most minimal example of a working standard Cocoa application available.

From there, it would simply be a matter of:

- creating an Application Delegate object

- responding to -applicationWillFinishLaunching: or - applicationDidFinishLaunching:

- grabbing whatever is needed from your framework and populating the menu bar

b.bum

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to