Re: Why are the simplest things the hardest?
Re: Why are the simplest things the hardest?
- Subject: Re: Why are the simplest things the hardest?
- From: Rick Mann <email@hidden>
- Date: Wed, 04 Jul 2018 21:44:30 -0700
> On Jul 4, 2018, at 21:31 , Ken Thomases <email@hidden> wrote:
>
> On Jul 4, 2018, at 10:45 PM, Rick Mann <email@hidden> wrote:
>>
>> I've overridden -acceptsFirstResponder to return true on the window
>> controller and view controllers.
>
> That doesn't do anything. -acceptsFirstResponder is a view method and is
> only called on views, not controllers.
Well, it's an NSResponder var, so I assumed any of them could become first
responder. Seems perfectly reasonable to choose the deepest appropriate
NSResponder, even if it's not a view.
>
>> I don't have any custom views in the window yet, just an SCNView and a
>> slider.
>
> I don't know if SCNView accepts first responder by default. You may need to
> use a subclass that overrides -acceptsFirstResponder.
>
> A slider would only accept first responder if System Preferences > Keyboard >
> Shortcuts > Full Keyboard Access is set to All Controls.
>
>
>> This begins to touch on another issue I'm not satisfied with: if I have
>> multiple NSViewControllers (say, in a split view), and I want them all to
>> respond to (different) menu commands, there seems to be no way to do that
>> directly, by sending command to the first responder, right?
>
> Correct. That's not an appropriate case for targeting the action at the
> first responder. You would either target the views directly or implement the
> action methods in a superview or its controller and have that dispatch things
> from there. You could implement some general scheme that searches the
> descendant views for one which responds and send it there. Or perhaps have
> the descendant views register their interest in a specific action method with
> the controller.
Okay, I'll have to do that, thanks.
Annoying I have to have a first responder view just to allow even my Document
to respond to menu commands.
>
> Regards,
> Ken
>
Thanks!
--
Rick Mann
email@hidden
_______________________________________________
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