Re: Receiving mouseEnter and mouseExit events.
Re: Receiving mouseEnter and mouseExit events.
- Subject: Re: Receiving mouseEnter and mouseExit events.
- From: Quincey Morris <email@hidden>
- Date: Tue, 19 Aug 2008 12:55:30 -0700
On Aug 19, 2008, at 12:04, David Alter wrote:
I'm a little confused on the mouse tracking. I have a view and I
want to track when the mouse enters and exits it. If I set
setAcceptsMouseMovedEvents to true for my window, (void)mouseMoved:
(NSEvent *)theEvent will get called. But, - (void)mouseEntered:
(NSEvent *)theEvent and - (void)mouseExited:(NSEvent *)theEvent will
not. Am I correct in my understanding that I need to create a
NSTrackingArea for these events to get called?
Yes, create a tracking area, but *don't* setAcceptsMouseMovedEvents:YES.
Both mechanisms result in mouseMoved events, but you only want the
events produced by the tracking area. (Well, you may not want
mouseMoved events at all, just mouseEntered and mouseExited, but you
tell the tracking area which of its possible events you want.)
_______________________________________________
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