On 28/04/2010, at 5:06 AM, Michael Dippery wrote:

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.


Aha! I just checked the Close item in my main menu nib's menu (which I hadn't deleted, so it's still the default one) and Control-clicking that reveals its (the menu item's) connections and it connects to performClose: in First Responder, not close:. So try connecting to that and see how it goes. Sorry for not checking before.

Ron

_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to