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
Delivered-to: email@hidden
Delivered-to: email@hidden
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:cc:message-id:from:to:in-reply-to:content-type:mime-version:subject:date:references:x-mailer; bh=xhMnkrVP20pmKtZzQw5BSwkYDjXAnM4q/+Qzy5RxSjM=; b=IR/YzinMUmEsgOiutymAlk1cKMjsI7NlZiLuwY5QRTfOe+5iiHLu5BiC8slaoVeIpch05NaCDrUxB6PhuN6ELjUUv2F8wE6odmZvfxFqExcrAvrGcrYr33swU2RYQ8cpOmzaTTWgE4Lkleag1TY4ITX9zq0aNKrjU015yi6siHE=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=cc:message-id:from:to:in-reply-to:content-type:mime-version:subject:date:references:x-mailer; b=FQ22zvcHCivlqy0ffDmj6bb8/Bvks3+gG2abJQ82PduwDn1xdNOeP1eg3aCEZ6cbCBOwH1NkUqGgK7iqbre+e7oRvGUL0B0VPe6dcyYzM0y+u9ClqfT9Q1kaOek+Y5zceOHpRWlxkh7xd/mwI4bl1aTma/Nn4rs0/KfirUIzJBo=
在 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
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.