On Jun 26, 2008, at 2:01 AM, Quincey Morris wrote:
Tracking rectangles were perhaps mostly used for dealing with
cursors. Tracking areas (NSTrackingArea) are useful for more things.
The NSWindow documentation used to (and I suppose still does)
discourages use of setAcceptMouseMovedEvents. The mouseMoved events
generated by tracking areas (NSTrackingMouseMoved option) aren't
discouraged, because they only occur upon movement inside the
tracking area, and the mouseMoved message is sent directly to the
tracking area's owner. You do *not* need to
setAcceptMouseMovedEvents:YES to use these tracking area mouseMoved
events. You don't even have to test if the event belongs to the
view, since you know it does. You just have to do a simple rectangle
check to find out which of your rects you hit (and with your
original implementation, don't you still have a few lines of code to
work out -- from the tracking area in the mouseEntered event --
which rectangle was hit?).
I must have overlooked the -mouseMoved: feature of tracking areas.
I've now changed from multiple tracking areas to one big area covering
the entire view. Doing the rectangle checks myself the view is as
responsive as expected. Thanks for pointing me in the right direction!
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