Re: NSView -scrollPoint doesn't work with mouse wheel?
Re: NSView -scrollPoint doesn't work with mouse wheel?
- Subject: Re: NSView -scrollPoint doesn't work with mouse wheel?
- From: Allen Dang <email@hidden>
- Date: Tue, 1 Jan 2008 10:51:13 +0800
在 2008-1-1,上午1:50, Bill Bumgarner 写道:
If the scroll view contains a text view, then use NSText's -
(void)scrollRangeToVisible:(NSRange)range; method.
For NSView, try -scrollRectToVisible: instead. It is sort of the
focal point for all scrolling operations in NSView.
However, if the behavior persists then -- obviously -- something
else is going on. Are you setting the scrolling position from a
thread, perchance? That could cause confusion.
b.bum
I'm trying to implement a auto scroll down mechanism in a NSTextView.
I use a NSTimer to trigger following code:
- (void)startScroll:(NSTimer *)theTimer
{
//Start scroll.
NSPoint currentScrollPosition=[[scrollView contentView] bounds].origin;
NSPoint maxPosition = NSMakePoint(0.0,NSMaxY([[scrollView
documentView] frame])
-NSHeight([[scrollView contentView] bounds]));
if (currentScrollPosition.y < maxPosition.y)
{
NSPoint newPosition = NSMakePoint(currentScrollPosition.x,
currentScrollPosition.y + 1);
[[scrollView documentView] scrollPoint:newPosition];
}
}
Allen Dang
email@hidden
_______________________________________________
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