Re: Make About window respond to ⌘W in UI-le ss application

2010-04-27 Thread Michael Dippery
> Sorry, didn't read your email properly.  If you've already created a menu in 
> your MainMenu nib and it's not working, perhaps you haven't actually made the 
> connection in the nib.  If that's the case, then you just need to 
> Control-drag from your Close menu item to the First Responder in the nib and 
> connect it to the close: action.  If you've already done that and it still 
> doesn't work then I'm lost.

I was afraid I'd forgotten the step of hooking up the Close menu item I created 
to First Responder's close: action, so I went ahead and tried again. Here is 
exactly what I did:

1. Created a new menu in MainMenu nib with a single item, Close, with the key 
mnemonic ⌘W.
2. Hooked up the menu item to the close: action in First Responder.

When I loaded up the app's About window and hit ⌘W, I got the usual system beep 
I described before.

Of course, the issue is that I _still_ may not have something in the responder 
chain set up to properly the keyboard event, but I'm not really sure what to do 
even if I _could_ respond to the keyboard event somewhere else (e.g., my 
delegate); I don't have a reference to the About window -- I assume it's 
created programmatically in -[NSApp orderFrontStandardAboutPanel:], and I can't 
find a method for grabbing a reference -- so I'm not sure how I could close it 
from some other part of the code anyway.




Michael Dippery
mdipp...@gmail.com | www.monkey-robot.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


Re: Make About window respond to ⌘W in UI-le ss application

2010-04-27 Thread Michael Dippery
> Don't why it's not working for you.  My LSUIElement app similarly has no menu 
> bar or dock icon, but it's various ancillory windows (About plain vanilla 
> version, Preferences) respond to key board short cuts which are set in the 
> main menu nib.  I have done no special hacks to achieve this, it Just Works™.
> 
> Does your app have a MainMenu nib file?

Perhaps this is why it isn't working: I do have a MainMenu nib, but I have long 
since deleted the MainMenu object in MainMenu.nib. I tried to add a new menu 
with a Close option that responds to the appropriate keyboard shortcut, but I'm 
not sure how make that the "main" menu. Maybe that's the issue?




Michael Dippery
mdipp...@gmail.com | www.monkey-robot.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


Make About window respond to ⌘W in UI-less app lication

2010-04-26 Thread Michael Dippery
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
mdipp...@gmail.com | www.monkey-robot.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