Re: Live scrolling
Re: Live scrolling
- Subject: Re: Live scrolling
- From: Eric Long <email@hidden>
- Date: Wed, 17 Nov 2004 11:03:58 -0800
> Use a separate thread for loading the icons for the whole list.
> When you open a directory send all the files to a worker thread,
Thanks for the feedback, Guy.
After staring at this, I'm thinking along these lines:
I've subclassed the NSScrollView that contains my outline view. I'm
overriding: -(void) reflectScrolledClipView:(NSClipView*)aClipView.
Here, I can get a notion of when scrolling starts. Via a timer, I can check
to see how long it's been since the last scroll time, and create a scrolling
stopped threshold. When the threshold is exceeded, I decide that it's safe
to start updating. My outline view is a now a subclass that my custom
NSScrollView can send a message to like this when scrolling begins:
[[self documentView] scrollView:self scrollingStarted:YES];
And this when scrolling ends:
[[self documentView] scrollView:self scrollingStarted:NO];
The idea being that my outline view can now refrain from drawing icons until
scrolling is stopped, then update the display. Everything else gets drawn,
so I still get most of the benefits of live scrolling, and icon updating
should be fast enough to not be an annoyance or distraction.
I'm hoping that when scrolling stops, I can just call reloadData for the
table to update the display, without having to get picky about which cells
actually require redrawing.
I haven't got this working yet, so I don't know if it'll work. Just testing
scroll detection, I ran into a caveat with the timer. While the mouse
remains down on the knob, whether you're still scrolling or not, the timer
doesn't fire. I figure that's because the main thread is tied up and it's
not getting air time. So, I'll have to use a secondary thread, like you
suggested.
Fingers crossed...
Eric
_______________________________________________
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