Make About window respond to ⌘W in UI-less application
Make About window respond to ⌘W in UI-less application
- Subject: Make About window respond to ⌘W in UI-less application
- From: Michael Dippery <email@hidden>
- Date: Mon, 26 Apr 2010 18:21:14 -0400
I'm building a Cocoa application that runs as an item in the status bar, and I'm using LSUIElement to prevent the app's icon from appearing in the Dock. This application has an About window and an item to activate that window, using the standard Cocoa mechanism for doing so (that is, -[NSApplication orderFrontStandardAboutPanel:]).
It works great except for one thing: unlike most About windows, it shows up _underneath_ all other windows, rather than on top. I worked around this by creating an IBAction in my app's controller that first brings the app to the front, and then shows the window, like so:
- (IBAction)orderFrontStandardAboutPanel:(id)sender
{
[NSApp activateIgnoringOtherApps:YES];
[NSApp orderFrontStandardAboutPanel:sender];
}
This causes the About window to appear on top of other windows, but the window does not respond to the ⌘W keyboard event; instead, I just get the system alert beep, indicating that nothing is in place to handle the event. Since I don't have a reference to the About window (as it's created by NSApplication) I can't figure out how to hook up a mechanism for handling the keyboard event, and it doesn't seem to get passed to my app controller, even though it's a delegate of NSApp (if I understand the responder chain correctly, NSApp will pass some unhandled events on to its delegate).
Is there a way to get the About window to respond to ⌘W?
Thanks,
----
Michael Dippery
email@hidden | www.monkey-robot.com
_______________________________________________
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