Re: Making a application active with NSStatusMenus
Re: Making a application active with NSStatusMenus
- Subject: Re: Making a application active with NSStatusMenus
- From: Andy Lee <email@hidden>
- Date: Sun, 25 Feb 2007 22:45:22 -0500
On Feb 25, 2007, at 9:26 PM, Andrew James wrote:
when a item in the menu is selected say the About item
it will call the window and make it key but the application is not
brought
to the front.
Is there a way to detect when a window opens or when the menu is
used so i
can make the application come to the front, ive tried
windowBecameKey but
could not get it to work but it may of been a mistake on my side.
The delegate method is windowDidBecomeKey: (note the colon), not
windowBecameKey. Was that a typo in your email?
How are you making the window come to front? Are you using an IB
connection between the menu item and the window? If so, are you
using -makeKeyAndOrderFront: as the action method? If not, that
might be why windowDidBecomeKey: isn't getting called -- it didn't
become key. Another reason might be if the About window is an
NSPanel, in which case it might not be able to become key -- see the
"How Panels Work" link in the NSPanel docs.
Do you really want the whole application to come to the front
whenever the About window comes to front (including switching windows
within the application), or only when the *menu* is used to open the
About panel? If the latter, you might want to write an action method
for the menu item and have the action method first call [NSApp
activateIgnoringOtherApps:YES] and then open the About window. If
necessary, you could check the sender argument to see if it's an
NSMenuItem.
--Andy
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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