On 28 May 2008, at 1:38 pm, Graham Reitz wrote:

What is the typical information that people get from a mouse dragged event?


Generally, the current mouse point and sometimes the modifier flags. There may be other useful stuff in there but I haven't used much else.

I tried getting the tracking area but ended up with an assertion error during runtime.

Do folks somehow get the direction of the drag, size of the rectangle, starting x,y, and etc.?


What rectangle?

If you want to use the mouseDragged: event to drag a rectangle, you need to record the anchor point on the mouseDown: event. Then the other corner is given in the mouseDragged: event (you also need to form the rectangle from these two points in a sensible way, I use this utility method:

NSRect NSRectFromTwoPoints( const NSPoint a, const NSPoint b)
{
        NSRect  r;
        
        r.size.width = ABS( b.x - a.x );
        r.size.height = ABS( b.y - a.y );
        
        r.origin.x = MIN( a.x, b.x );
        r.origin.y = MIN( a.y, b.y );

        return r;
}



If the direction of the drag is important, you need to record each coordinate in an ivar and compare it with the next one received by subtraction.

Not sure what tracking rect you mean though - the cursor tracking area?


hth,


Graham










_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to