Re: Problems manually scrolling a view using mouseDown:
Re: Problems manually scrolling a view using mouseDown:
- Subject: Re: Problems manually scrolling a view using mouseDown:
- From: "M. Uli Kusterer" <email@hidden>
- Date: Wed, 26 Jan 2005 06:25:53 +0100
At 13:33 Uhr -0800 24.01.2005, Matt Neuburg wrote:
On Sun, 23 Jan 2005 21:28:46 -0800, mmalcolm crawford <email@hidden>
said:
>That document is, unfortunately, misleading (and a bug has been filed).
You should not set up your own "mini event loop" in this way. You
should instead capture the relevant information in mouseDown: and then
deal with updates in mouseMoved: and mouseUp:.
Okay, I'm adaptable. Here's the Damn-The-Documentation, Full-Speed-Ahead
version:
- (void) mouseDown: (NSEvent*) e {
clickPoint = [e locationInWindow];
originalOrigin = [cv bounds].origin;
[cv setDocumentCursor: [NSCursor openHandCursor]];
}
- (void) mouseDragged: (NSEvent*) e {
NSPoint newPoint = [e locationInWindow];
NSPoint newOrigin = NSMakePoint(originalOrigin.x, originalOrigin.y +
(clickPoint.y - newPoint.y));
[cv scrollToPoint: [cv constrainScrollPoint: newOrigin]];
[sv reflectScrolledClipView: cv];
}
- (void) mouseUp: (NSEvent*) e {
[cv setDocumentCursor: nil];
}
What happens when the mouse moves out of the view during dragging?
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden