Re: NSScrollView "autoscroll" while adding data?
Re: NSScrollView "autoscroll" while adding data?
- Subject: Re: NSScrollView "autoscroll" while adding data?
- From: Jens Alfke <email@hidden>
- Date: Sun, 20 Apr 2008 19:12:42 -0700
On 20 Apr '08, at 5:38 PM, Jack Repenning wrote:
I confess what I actually want is a bit more complicated than always
positioning at the bottom: if the user has moved the thumb about,
then the user's chosen position should win; it's only if the thumb
is bottomed at the moment I add the next line that I would
"autoscroll." I suspect some further subtleties lurk in the
neighborhood of the transition out of "not enough data even to fill
one screen full." This seems familiar enough, and subtle enough,
that surely it must be hiding in the library somewhere? I don't
have to reinvent this wheel, do I? Because I went lookin' for the
pieces to do that, and came up dry there as well!
You have to implement it yourself.
1. Before appending text, check the view's vertical scroller to see if
it's at the bottom.
2. Append the text.
3. If the scroller used to be at the end, scroll to the bottom by
getting the coordinates of the bottom of the view and telling the view
to scroll to there by calling scrollRectToVisible:.
—Jens
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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