Re: Hooking up Help menu item
Re: Hooking up Help menu item
- Subject: Re: Hooking up Help menu item
- From: Graham Cox <email@hidden>
- Date: Sat, 15 Feb 2014 21:42:15 +1100
On 15 Feb 2014, at 8:40 pm, Roland King <email@hidden> wrote:
> want the help menu item in my app to redirect to a webpage, the redirect I can do fine, it's hooking it up confuses me.
>
> That menu item sends by default showHelp: to First Responder. So I wrote a showHelp: method in the App Delegate but it doesn't get called, I still get the 'help not available' popup.
>
> I have a different menu item which sends a custom action, onCommandLog: to First Responder and that one does happily find the implementation in the App Delegate, why does the menu showHelp: not work the same way? I can hook it up directly to the delegate but I'm trying to use (and understand) the responder chain.
>
> This is the second responder chain issue which has confused me, another menu item had to be hooked up to point directly to an NSView subclass because sending that to First Responder didn't work either. I eventually decided the window wasn't in the chain so it wasn't getting it.
>
-showHelp: is only implemented by NSApplication, as far as I can tell it isn't passed to the app delegate. The standard -showHelp: method opens your app's Help Book if it has one and you've set up the necessary info in the info.plist. The message you're seeing is what happens when the info isn't there or the Help Book isn't there.
The application delegate is after NSApplication in the responder chain, so because -showHelp: is a method of NSApplication, the method isn't forwarded to the delegate.
The easiest solution to this is to define your own action, name it whatever you want, and set the standard Help item to invoke that action instead.
--Graham
_______________________________________________
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