• 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 20:45:32 -0700


> On Jul 4, 2018, at 20:40 , Ken Thomases <email@hidden> wrote:
>
> On Jul 4, 2018, at 9:08 PM, Rick Mann <email@hidden> wrote:
>>
>> I'm writing a new macOS app. I started with the document-based app template
>> (no core data). I have a custom window controller, and a hierarchy of custom
>> NSViewControllers embedded in a split view controller (I even subclassed the
>> split view controller).
>>
>> I have a simple IBAction method that logs a debugging message, and I try to
>> send that action from a menu item to the first responder. I want to
>> implement that method in one of my view controllers, but it never seems to
>> get called. I've tried adding the method to every view controller, the
>> window controller, and the app delegate, but it never gets called. However,
>> if I connect the menu item to the app delegate, it gets called.
>>
>> What am I doing wrong?
>
> Is one of your views actually the first responder?  Does the window have key
> or main status?  By default, it wouldn't be able to become key or main if it
> doesn't have a title bar and isn't resizable.  Is there a view that accepts
> first responder (has overridden -acceptsFirstResponder to return YES)?  (Of
> course, certain standard controls like NSTextField accept first responder
> without you having to subclass them.)

I've overridden -acceptsFirstResponder to return true on the window controller
and view controllers. I don't have any custom views in the window yet, just an
SCNView and a slider.

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?

>
> I assume you're running macOS 10.10 or newer.  If not, you would have to take
> special steps to include those controllers in the responder.

Yes, 10.13.5

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

  • Follow-Ups:
    • Re: Why are the simplest things the hardest?
      • From: Ken Thomases <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>)

  • 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