• 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: Keep sibling view in Responder Chain
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Keep sibling view in Responder Chain


  • Subject: Re: Keep sibling view in Responder Chain
  • From: Uli Kusterer <email@hidden>
  • Date: Sun, 29 Dec 2013 01:59:41 +0100

On 28 Dec 2013, at 18:48, Trygve Inda <email@hidden> wrote:

>>
>> On 27 Dec 2013, at 13:52, Trygve Inda <email@hidden> wrote:
>>
>>> I have a document with a SourceView on the left side (like iTunes). Some
>>> main menu commands pertain to actions in the Source View. This works fine if
>>> the SourceView is the active view but my window has other views held in a
>>> SplitView.
>>>
>>> If a sibling of the SourceView is active, the SourceView is not in the
>>> responder chain and thus my menu commands are greyed out.
>>>
>>> How can I keep a sibling view in the responder chain?
>>>
>>> The alternative is I have to re-create "passthrough" methods in my Document
>>> object that pass the real action through to the SourveView since the
>>> Document object always is part of the Responder Chain.
>>
>> That’s what I usually do. Alternately, if I have a view controller for the
>> source view, I use setNextResponder: to insert the view controller in the
>> responder chain somewhere farther up.
>>
>> Cheers,
>> -- Uli Kusterer
>> “The Witnesses of TeachText are everywhere...”
>> http://zathras.de
>>
>>
>
> Can you give an example of how you do that? I guess I'd want it right after
> my document controller. Do I need to walk the list looking for my document
> controller?
>
> Or just do:
>
> [[document windowController] setNextResponder:sourceViewController]
>
> Trygve

Well, you’ll also want to give the document a shot, so

sourceViewController.nextResponder = document.windowController.nextResponder;
document.windowController.nextResponder = sourceViewController;

That way you insert between the window controller and the document. For window controllers without a document, the next responder is usually the application, IIRC, so you don’t want to sever the chain.

That said, the supplemental target thing someone else suggested sounds like a nice and clean way of doing it that I haven’t tried yet.

Cheers,
-- Uli Kusterer
“The Witnesses of TeachText are everywhere...”
http://zathras.de


_______________________________________________

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: Keep sibling view in Responder Chain
      • From: Trygve Inda <email@hidden>
References: 
 >Re: Keep sibling view in Responder Chain (From: Trygve Inda <email@hidden>)

  • Prev by Date: Re: Two problems trying to use NSTextView for a scrolling console/terminal like view
  • Next by Date: Re: UISlider with custom images & narrow thumb
  • Previous by thread: Re: Keep sibling view in Responder Chain
  • Next by thread: Re: Keep sibling view in Responder Chain
  • Index(es):
    • Date
    • Thread