Synchronized scrolling - I'm stuck.
Synchronized scrolling - I'm stuck.
- Subject: Synchronized scrolling - I'm stuck.
- From: Todd Blanchard <email@hidden>
- Date: Mon, 11 Jul 2005 21:39:58 -0700
I'm attempting to implement the ever popular split table effect. I
created a custom view which has a reference to each NSScrollView that
encloses each table.
I then copy the target/action from the vertical scroller of the right
one, then replace it with my own to intercept the message, then
forward the action to both scrollers. It does something, but it is
not properly synchronized. Here is my code:
-(void)awakeFromNib
{
NSScroller* scroller = [rightScrollPane verticalScroller];
// remember the old target/action
_rightScrollerTarget = [scroller target];
_scrollerAction = [scroller action];
// intercept the action messages
[scroller setTarget: self];
[scroller setAction: @selector(scrollerChanged:)];
}
-(void)scrollerChanged:(id)scroller
{
// invoke the original action on the original target
[_rightScrollerTarget performSelector: _scrollerAction
withObject: scroller];
NSScroller* leftScroller = [leftScrollPane verticalScroller];
[leftScroller setFloatValue: [scroller floatValue]
knobProportion: [scroller knobProportion]];
[[leftScroller target] performSelector: [leftScroller action]
withObject: leftScroller];
[leftScrollPane setVerticalLineScroll: [rightScrollPane
verticalLineScroll]];
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden