Re: Keep sibling view in Responder Chain
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