Re: Confused about NSTrackingAreas with autoscroll [WORKAROUND]
Re: Confused about NSTrackingAreas with autoscroll [WORKAROUND]
- Subject: Re: Confused about NSTrackingAreas with autoscroll [WORKAROUND]
- From: Corbin Dunn <email@hidden>
- Date: Thu, 05 Feb 2009 08:02:33 -0800
On Feb 4, 2009, at 5:51 PM, Luke Evans wrote:
OK, FWIW for the record here is the resolution I've arrived at:
mouseEntered and mouseExited events from tracking areas that are
active when mouse dragging begins are dysfunctional in the drag,
specifically when autoscrolling at the boundaries of the cliprect.
I have a drag event loop per one of the suggested methods of handing
drag in the Cocoa Event-Handling Guide, and start/stop NSPeriodic
events to perform autoscrolling.
By way of a work-around, my drag loop requests these events in
nextEventMatchingMask, but does not dispatch them.
NSLeftMouseDragged is dispatched from the loop, and in the
appropriate mouseDragged handler there's code to detect important
boundary crossings (ordinarily handled by the tracking areas) that
then sends synthetic mouseEntered and mouseExit events before
handling the normal drag actions. The mouseEntered and mouseExit
methods handle all the tracking area boundary crossing in all cases
(and were working without any special work in the case of non-
dragging mouse moves and even dragging that didn't involve
displacement of the view in scroll view).
Well, the trouble is, if you are consuming the event loop, then you
need to dispatch things.
Have you seen: http://developer.apple.com/samplecode/PhotoSearch/
?
The cell consumes the event loop and dispatches events. Look at the
code via http://developer.apple.com/samplecode/PhotoSearch/listing9.html
ie:
if ([theEvent type] == NSMouseEntered || [theEvent type] ==
NSMouseExited) { [NSApp sendEvent:theEvent]; }
But do please log a bug; at worst, we can clarify with better
documentation, or make it easier (somehow) with new API.
corbin
_______________________________________________
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