• 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
Synchronized scrolling - I'm stuck.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Prev by Date: Re: "untitled" vs "Untitled" (code correction)
  • Next by Date: NSDatePicker: Multiple selections?
  • Previous by thread: Re: iTunes like Source Header
  • Next by thread: NSDatePicker: Multiple selections?
  • Index(es):
    • Date
    • Thread