Re: Confused about NSTrackingAreas with autoscroll [WORKAROUND]
Re: Confused about NSTrackingAreas with autoscroll [WORKAROUND]
- Subject: Re: Confused about NSTrackingAreas with autoscroll [WORKAROUND]
- From: Luke Evans <email@hidden>
- Date: Wed, 4 Feb 2009 17:51:49 -0800
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).
So far, this approach seems to satisfactorily make up for the apparent
'misplacement' of the tracking areas if the scroll viewport is moved
over the view while in the drag operation (as happens with autoscroll).
I'm certainly not sure that there's no better fix for this situation
(including the possibility that there might be a way to have the view
hierarchy 'fix up' the tracking areas correctly after the autoscroll
is performed), but so far nobody has suggested that I might be missing
some piece of magic, so chances are that this problem is 'real' and
requires some sort of work-around if you have a similar code
configuration.
_______________________________________________
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