Re: Need the Why and How of mouseDragged:
Re: Need the Why and How of mouseDragged:
- Subject: Re: Need the Why and How of mouseDragged:
- From: Alastair Houghton <email@hidden>
- Date: Thu, 13 Dec 2007 15:34:09 +0000
On 13 Dec 2007, at 14:30, Jerry Krinock wrote:
I'm implementing drag and drop in a custom view (i.e., a subclass of
NSView). It works if I send
dragImage:at:offset:eventpasteboard:source:slideBack: in mouseDown:,
except that the only [event type] I ever receive in mouseDown: is
NSLeftMouseDown. So I can't distinguish clicks from drags. If I
set a drag image unconditionally, the image flashes on the screen if
the user only clicks, which is annoying.
It seems that mouseDragged: would be more sensible method from which
to send dragImage:at:offset:eventpasteboard:source:slideBack:. But
I never get any mouseDragged:messages. Reading the list archives, I
get the impression that there might be some kind of trick to getting
these, but I can't find the trick.
There's no trick here. The problem you're seeing is most likely that
RBSplitView is running a mouse tracking loop when it gets -mouseDown:,
which is eating all the -mouseDragged events.
Unfortunately, if a view uses this style of mouse tracking, it's
difficult to add additional code to do something different (unless the
view has adequate hooks built into it) without modifying the original
source code or re-implementing the existing behaviour.
It would be worth considering whether you should be implementing your
drag & drop on the RBSplitView subclass itself or whether your code
really belongs in a child view of the RBSplitView.
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden