• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Make About window respond to ⌘W in UI-less application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Subject: Re: Make About window respond to ⌘W in UI-less application
  • From: Ron Fleckner <email@hidden>
  • Date: Wed, 28 Apr 2010 08:47:50 +1000


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@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


References: 
 >Make About window respond to ⌘W in UI-less application (From: Michael Dippery <email@hidden>)
 >Re: Make About window respond to ⌘W in UI-less application (From: Ron Fleckner <email@hidden>)
 >Re: Make About window respond to ⌘W in UI-less application (From: Michael Dippery <email@hidden>)
 >Re: Make About window respond to ⌘W in UI-less application (From: Ron Fleckner <email@hidden>)
 >Re: Make About window respond to ⌘W in UI-less application (From: Michael Dippery <email@hidden>)

  • Prev by Date: Re: white screen windows at first
  • Next by Date: Re: Fastest way to check for descendants of an object
  • Previous by thread: Re: Make About window respond to ⌘W in UI-less application
  • Next by thread: Re: Make About window respond to ⌘W in UI-less application
  • Index(es):
    • Date
    • Thread