adding delegate to responder chain stops scrolling from working

65 views Asked by At

For a number of reasons, I have added my class that implements NSOutlineViewDelegate protocol to the responder chain:

[myOutlineView setNextResponder:self];

This stops my outline view from scrolling. Take the call out - scrolling works fine, put it back - scrolling stops. If I use the up and down arrows to move the selection through the view it scrolls to show the selected row OK, but gesture scrolling doesn't do anything.

The delegate contains quite a few methods for supporting drag and drop, and ibaction methods for supporting context menus, but I can't think what is in there that would interfere with scrolling (I am using a macbook air with gesture scrolling). Anyone got any ideas what is causing the interference? or any ideas how to diagnose?

I should add that I made the delegate class a subclass of NSResponder.

1

There are 1 answers

0
Gordon On BEST ANSWER

So the answer is, when adding a delegate into the responder chain, you must also add to the delegate the responder that used to be in its place - otherwise the chain gets broken and the events don't get handled, so it goes:

    NSResponder *nextResponder = myOutlineView.nextResponder;
    [myOutlineView setNextResponder:self];
    [self setNextResponder:nextResponder];

With the responder chain restored, my outline view now scrolls again. Hooray