Re: What am I doing wrong in my drag loop? Dragging jumps all over the place.
Re: What am I doing wrong in my drag loop? Dragging jumps all over the place.
- Subject: Re: What am I doing wrong in my drag loop? Dragging jumps all over the place.
- From: Dave Camp <email@hidden>
- Date: Wed, 20 Jul 2005 10:37:50 -0700
On Jul 20, 2005, at 10:22 AM, Sean McBride wrote:
On 2005-07-20 10:02, Dave Camp said:
theEvent = [[self window] nextEventMatchingMask:
(NSLeftMouseDraggedMask | NSLeftMouseUpMask)];
NSPoint curPoint = [self convertPoint:[theEvent
locationInWindow] fromView:nil];
You aren't checking theEvent for nil. nextEventMatchingMask: is
documented to possibly return nil. locationInWindow returns an
NSRect,
but you can't rely on the return value of a message to a nil object
(at
least not when its a struct).
Funny you post this today, I just fixed this exact bug in a 3rd party
library the other day. :)
Good catch on the nil event, but the problem is still there.
I added an if (theEvent) around the guts and I still get the same
behavior.
NSEvent.h shows locationInWindow: returning an NSPoint, not an NSRect
- (NSPoint)locationInWindow;
The log output when I drag slowly looks like the following. As you
can see, convertPoint:fromView: seems to be alternating between good
coordinates and bad ones.
12, 104
15, -77
13, 104
16, -78
13, 103
17, -78
13, 103
Any other ideas? I expect this is something stupid I'm doing but I
can't see it...
Dave
---
Among the chief weapons of UNIX: Fear, surprise and ruthless
efficiency.
_______________________________________________
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