This works to update the main menu. Kind of a kludge, since the menu is already set as visible, but it must also force a redraw.

[NSMenu setMenuBarVisible:YES];
[MyWindowController showWindow:self];

On Aug 10, 2011, at 5:42 PM, Laurent Daudelin wrote:

On Aug 10, 2011, at 14:25, Michael Domino wrote:

Hi,

My app sometimes runs by being started by a launch agent. When that happens, the app in minimized in the Dock by calling the NSApplication method miniaturizeAll. That works fine. When the operation is complete, I want to again show the app, so I call the NSWindowController method showWindow. The windows are brought out of the Dock and the main window is active and in the front, which is good. The problem is that the app's main menu is not updated, so the menu of whatever app was in the front at the time my app was started is still visible. My app's menu appears if I switch to another app in the Finder, and then back to my app, or if I do a key-equivalent of a menu item.

Is there some way to force the main menu to update? I've tried a bunch of things, but nothing seems to work. I tried using NSApplication unhide and activateIgnoringOtherApps, but that didn't help.

This is only a problem in 10.5 and 10.6. The problem does not occur in Lion, which makes me suspect that it's a system bug.

Thanks,
Michael

Did you try to make the window key, as in "makeKeyAndOrderFront:"?

-Laurent.
--
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin                                 
http://www.nemesys-soft.com/
Logiciels Nemesys Software                                      
laur...@nemesys-soft.com


<<inline: image001.png>>

Michael Domino | Identity Finder, LLC
250 West 57th St; Suite 2412 | New York, NY 10107
P: 617-816-5851 | F: 888-206-6389 | E: michael.dom...@identityfinder.com

_______________________________________________

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 arch...@mail-archive.com

Reply via email to