Re: Auto-scrolling
Re: Auto-scrolling
- Subject: Re: Auto-scrolling
- From: Kevin Ballard <email@hidden>
- Date: Mon, 22 Mar 2004 23:13:57 -0500
On Mar 22, 2004, at 4:40 PM, Mark Alldritt wrote:
>
I've got a custom NSView and I'm calling autoscroll in my mousDragged
>
method
>
to implement auto-scrolling. The problem is that this only works
>
while the
>
user is moving the mouse.
>
>
Is there some obvious call I can make to continue auto-scrolling when
>
the
>
mouse pauses? I can use a timer, but I'm not sure how to synthesize
>
the
>
NSEvent instance that must be passed to autoscroll.
Aaron Hillegass provides the solution in his book Cocoa Programming for
Mac OS X:
In mouseDown:, create a repeating timer that invokes a method in the
view every tenth of a second. In the invoked method, autoscroll using
the current event. To get the current event, use NSApplication's
currentEvent method:
NSEvent *e = [NSApp currentEvent];
Invalidate and release the timer in mouseUp:. Note that the
autoscrolling becomes much smoother and more predictable.
--
Kevin Ballard
email@hidden
http://www.tildesoft.com
http://kevin.sb.org
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.