trick to getting an NSMenu to be app's main menu?

Chad Leigh -- ObjectWerks Inc <chad+macosx-AU1NHruoRJaEK/[email protected]>
Newsgroups gmane.comp.macosx.devel
Message-ID <[email protected]>
In my app I am working on, I have modified main.m to do some license checking (vendor of licensing product suggested to do checks before any bundles are loaded) and then, if the license is there then do a normal launch of the app using a deconstructed NSApplicationMain(argv, argc), but if the license is not there I launch a different registration and setup bundle instead.  I am not able to get a menu when launching this alternate bundle

The main.m basically does the following in order to run this alternative controller and bundle  (there are some license existence checks etc going on not shown but that have nothing to do with any nib)

		[NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

		[NSApplication sharedApplication];   // sets up window manager etc

		PrefController *prefController = [[PrefController alloc] init] ;

                [prefController  doStartupRegistration];


                [pool release];

                return 0;


Inside the PrefController  object it loads its own nib and sets itself the owner.  The xib has a main menu NSMenu defined in it (copied from a fresh Cocoas app XCode wizard creation).   I tried naming it MainMenu as well as naming it after the xib file (bundle name).  I also have the following code in the awakeFromNib of this controller and it does get run.


	[NSApp setMainMenu:prefsMainMenu];
	[NSMenu setMenuBarVisible:YES];


But I don't get any menu except the basic Apple and Application menu that you get anyway.  I ran just the first line first and added the second line as a try after the menu did not show.

Is there a trick to replacing the main menu?  I have read through the menu handling and NSApplication bits on apple.com but did not see anything obvious.

Thanks
Chad
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.