[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Appkit notifications issue in win32 NSApplication startup

From: MA Garcias
Subject: Appkit notifications issue in win32 NSApplication startup
Date: Wed, 28 Jul 2004 18:24:26 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113

After some research, we've figured out the problem we're having with the appkit under win32 (that thing with the main menu I asked for in my last post):

When the main menu of the application is created, it adds itself as an observer of the NSApplicationWillBecomeActiveNotification. When the notification come, then the mainMenu displays itself. It is very common that an application creates the menu in the applicationWillFinishLaunching method of a delegate, that is called when a similar notification is raised.

In win32, the NSApplicationWillBecomeActiveNotification is posted from the backend when the ACTIVATEAPP win message is received. The problem is that the ACTIVATEAPP message is raised too soon, before the main menu is created, and then the NSApplicationWillBecomeActiveNotification is not received for the main menu and it is not displayed.

A first solution we've found is to hack the NSApplication to raise the applicationWillFinishLaunching notification earlier, so that the display notification is sent after the main menu creation.

The problems with this solution are (1) unknown impact of this modification on the rest of the Appkit workings, and (2) applications using .nib or .gorm files don't create the main menu in its applicationWillFinishLaunching event, but later on the application run menu. Then, the main menu is not displayed.

Another solution would be explictly calling display on the main menu (if there is one) after all initialization in NSApplication as a way to bypass this problem, before theNSApplicationDidFinishLaunching notification. This ensures that the main menu is displayed in both .nib and other (regular) applications. What it doesn't solve is the notification actually being sent to the main menu, which I'm not sure if it is actually required.

And that's why I'm turning to all of you. Any suggestions? (I know the problem seems a little hard to understand, but that happens with synchronization issues - ask for more details if needed).

maGarcias | tragnarionStudios

reply via email to

[Prev in Thread] Current Thread [Next in Thread]