Am 27.04.2010 um 21:06 schrieb 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.
> 

I don't know how to create a new "MainMenu" from scratch, but my suggestion 
would be to create a new plain app project, open the MainMenu NIB, copy the 
MainMenu object from there and paste it into your MenuMenu NIB. Then, remove 
all unneeded menus & items and remember to wire up your "Close Window" item to 
the "performClose:" action in First Responder.

</jum>




--
Jens Miltner                                                   j...@mac.com

"...their fundamental design flaws are completely hidden by their
superficial design flaws."
(Douglas Adams, "So long, and thanks for all the fish")



_______________________________________________

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