• 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: Why are the simplest things the hardest?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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:59:57 -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.
>
>> 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.

Hmm, I tried this. It doesn't seem to make anything in my responder chain
respond. I tried calling becomeFirstResponder() on it when the view controller
loaded. Doesn't seem to have any effect.

Dropping an NSTextView randomly into my window did enable my responder chain.

>
> 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.
>
> Regards,
> Ken
>


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

References: 
 >Why are the simplest things the hardest? (From: Rick Mann <email@hidden>)
 >Re: Why are the simplest things the hardest? (From: Ken Thomases <email@hidden>)
 >Re: Why are the simplest things the hardest? (From: Rick Mann <email@hidden>)
 >Re: Why are the simplest things the hardest? (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: Why are the simplest things the hardest?
  • Next by Date: Re: Why are the simplest things the hardest?
  • Previous by thread: Re: Why are the simplest things the hardest?
  • Next by thread: Re: Why are the simplest things the hardest?
  • Index(es):
    • Date
    • Thread