• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: What am I doing wrong in my drag loop? Dragging jumps all over the place.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >What am I doing wrong in my drag loop? Dragging jumps all over the place. (From: Dave Camp <email@hidden>)
 >Re: What am I doing wrong in my drag loop? Dragging jumps all over the place. (From: "Sean McBride" <email@hidden>)

  • Prev by Date: Re: Adding 30 minutes to an NSDate
  • Next by Date: [ANN] Silicon Valley CocoaHeads forming
  • Previous by thread: Re: What am I doing wrong in my drag loop? Dragging jumps all over the place.
  • Next by thread: Re: What am I doing wrong in my drag loop? Dragging jumps all over the place.
  • Index(es):
    • Date
    • Thread