[Top][All Lists]

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

Re: Appkit notifications issue in win32 NSApplication startup

From: Gregory John Casamento
Subject: Re: Appkit notifications issue in win32 NSApplication startup
Date: Wed, 28 Jul 2004 17:16:39 -0700 (PDT)


See below...

--- MA Garcias <address@hidden> wrote:
> 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 method applicationDidFinishLaunching: by definition (as it's name
indicates) comes after ALL initialization has occurred.   Oddly this seems to
work fine on Linux and Solaris.
> 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.

Both of these impacts are obviously unacceptable in any case.   

> 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.

This might be slightly better, but it still doesn't seem right.

> 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).

I'll let you know.

> maGarcias | tragnarionStudios

Gregory John Casamento -- CEO/President Open Logic Corp.
#### Maintainer of Gorm for GNUstep.

reply via email to

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