issues with mainMenu and initialization timing
issues with mainMenu and initialization timing
- Subject: issues with mainMenu and initialization timing
- From: David Alter <email@hidden>
- Date: Tue, 23 Sep 2008 13:39:04 -0700
I'm working on a x-platform application that is written in Carbon and
we are moving it to cocoa. I have it using a native Cocoa run loop as
the main event loop. It is a nibless application. I jump through a few
hoops for that to work correctly. Now I'm experiencing some very
strange behaviors with the main menu. None of the menus or keyboard
equivalents will work until you have selected the application menu.
You do not need to choose a menu option you just need to select the
menu.
Suspecting this had something to do with the timing of the
initialization I made a sample project and created the menu bar very
early on. This resulted in the same issue. So I moved the creation of
the main menu to when applicationWillFinishLaunching was called on my
delegate. This fixed the issue on my sample project. On the main
application I did the same thing. This did NOT fix the issue. There is
a number of other things initializing very early on in this
application, including some carbon events registering and even a
window could potentially open.
I'm at a little bit of a loss on what to try next. Because it is cross
platform it is not easy for me to change the initialization process.
The code is very dependent on the initialization being sequential.
Cocoa notifies me when it is ready for me to initialize things. ( i.e.
applicationWillFinishLaunching ). If I created the main menu before
NSApp run is called I have problems ( applicationWillFinishLaunching
is called after run ). On the other hand it is problematic for me to
drop into the run loop before initializing the the cross platform code.
One option would be to over ride the run in NSApp. I must admit that I
would like to avoid that option if at al possible. Apple documentation
highly discourages it.
Is there a way that I can force Cocoa to initialize before calling run?
Is there some good example code on overloading run?
thanks for the help
-dave
_______________________________________________
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