Re: NSMouseEntered during drag op, losing window reference
Re: NSMouseEntered during drag op, losing window reference
- Subject: Re: NSMouseEntered during drag op, losing window reference
- From: Luke Evans <email@hidden>
- Date: Fri, 30 Jan 2009 11:12:19 -0800
Erg. This one is driving me loopy.
With mouse events suddenly losing their window pointer when the mouse
is dragged outside the window and then back, I've tried substituting a
newly created NSMouseEntered _with_ the correct window (and other
elements) from the windowless NSMouseEntered that is delivered, but I
get various asserts in NSEvent, or other effects when I try to
dispatch the event with sendEvent (on NSApp or the target window).
Any suggestions would be greatly appreciated.
-- lwe
On 28-Jan-09, at 3:57 PM, Luke Evans wrote:
I've been following some Apple sample code with respect to mouse
dragging logic (within a table - but that's probably not important).
The particular approach involves maintaining full control of the
drag state by starting a loop that processes all pertinent events
until the mouse button is released.
By and large this works fine, you can watch and react to the events
during the drag operation and you can dispatch events for 'normal'
processing as necessary with:
[NSApp sendEvent:event];
Now, I need to handle dragging beyond the bounds of the originating
view because I wish to implement auto-scrolling during the drag.
This actually works great using NSPeriodic events.
There's one fly in the ointment however. When the mouse leaves the
bounds of the view, I correctly get an NSMouseExited event from the
tracking area that is set up. However, when the mouse reenters the
view/tracking area, still under drag, I get an NSMouseEntered, but
the window is nil. This causes grief, and is in contrast with a
NSMouseEntered events that happen when I'm not managing the drag.
I'm wondering if I'm missing a way to lock the window as the event
target while I'm dragging (after all, code associated with this
window is 'in control' at this point and making decisions about the
meaning of all mouse movement).
Various ideas for hacking a solution present themselves (after all,
at least I'm not _missing_ the event entirely), but I'm inclined to
believe that the source of my angst is likely correctable by more
respectable, and/or canonical means.
Cheers
-- Luke
_______________________________________________
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