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: Matt Neuburg <email@hidden>
- Date: Wed, 26 Jan 2005 08:26:24 -0800
On Wed, 26 Jan 2005 06:25:53 +0100, "M. Uli Kusterer"
<email@hidden> said:
>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?
Try it and see. I regard what happens as completely coherent, but obviously
if you don't you can write your own code. m.
--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide
<http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt>
_______________________________________________
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