Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSView -scrollPoint doesn't work with mouse wheel?




在 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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >NSView -scrollPoint doesn't work with mouse wheel? (From: Allen Dang <email@hidden>)
 >Re: NSView -scrollPoint doesn't work with mouse wheel? (From: Bill Bumgarner <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.