Ah-ha.  Thanks!  When I gave something else in the view focus, the menu was 
validated as expected, because the responder chain then would have gone through 
my view controllers.

This also explains why it makes sense to insert the NSViewControllers above 
NSWindow in the responder chain (which other examples suggested).  I couldn't 
see (or misunderstood) the reason why you'd want to go that route.  The answer 
is that what I expected to be first responder wasn't first responder, and was 
more likely to be the window.

It's always incredibly obvious once you get it pointed out to you.

Thanks again.

Arved


On 2013-01-07, at 12:31 , Ken Thomases <k...@codeweavers.com> wrote:
> On Jan 6, 2013, at 6:53 PM, Arved von Brasch wrote:
>> 
>> 'showSettings:' is implemented in the ABItemsXibManager class, and it 
>> clearly responds to the selector as the above debug shows, but even here 
>> there is no debug from it to indicate it is being called, although the 
>> function has clearly been recognised on the responder chain.
> 
> You have dumped _a_ responder chain from the button up.  However, you haven't 
> shown what is the _first_ responder and the chain from that.  Unless your 
> user settings (in System Preferences > Keyboard) is set to allow buttons to 
> have keyboard focus, the button and tab views won't be the first responder.  
> Unless some view in the window (e.g. a text field) accepts first responder 
> (overrides -acceptsFirstResponder to return YES), then the window itself is 
> likely to be the first responder.  Since that's above your view controller, 
> your view controller won't be in the responder chain flowing from the first 
> responder.
> 
> 
>> As far as I can see, the validateMenuItem: method in ABItemsXibManager class 
>> is never called, even though it clearly is in the responder chain.
> 
> Again, it's in _a_ responder chain, but not the one flowing from the first 
> responder.
> 
> If you want a menu item to operate on something which is not chosen by the 
> keyboard focus, then you should target that thing directly rather than 
> targeting First Responder.
> 
> Regards,
> Ken
> 


_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to