Working on a Cocoa App where the app needs to do two things in case - :
1) mouse entered or exited
2) mouse dragged files to the app
I have view A, view A is registered for receiving dragging events and has tracking area for receiving mouse entered and exited events,
Issue is: If I drag files to the view A; view A receives the mouseEntered: event instead of draggingEntered: event.
- (NSDragOperation)draggingEntered:(id < NSDraggingInfo >)sender
{
NSLog(@"draggingEntered called");
}
- (void)mouseEntered:(NSEvent *)theEvent
{
NSLog(@"mouseEntered called");
}
2018-02-05 14:08:58.273 XXX_APP [3420:119122] mouseEntered called
2018-02-05 14:08:58.273 XXX_APP [3420:119122] draggingEntered called
Issue is whenever I drag files to the view; It goes into the mouseEntered() not into the mouseDragged(). Is there any workaround for this?
Thanks in advance.
[super mouseEntered:theEvent]
? If not, the event is going to get swallowed up and could be preventing thedraggingEntered:
method from being called. – theeagleNSTrackingEnabledDuringMouseDrag
. From the docs, it sounds like you can make the distinction between the two events with this flag. Hope that helps! – theeagle