Safe to install NSTrackingArea on a subview?
Safe to install NSTrackingArea on a subview?
- Subject: Safe to install NSTrackingArea on a subview?
- From: Kyle Sluder <email@hidden>
- Date: Thu, 15 Nov 2012 17:55:53 -0800
I just put together a quick sample project to prove to myself that one
can safely install a tracking area on a subview:
http://www.optshiftk.com/wp-content/uploads/2012/11/SubviewTrackingArea.zip
But I'm still not convinced that this is guaranteed to work. It doesn't
help that using Google I cannot find any instance of -addTrackingView:
being sent to a receiver other than self except in extremely shady cases
like hacking with NSThemeFrame.
In particular, I'm concerned about -updateTrackingAreas. This message is
sent to the view, not the tracking area's owner, but the view itself
doesn't know about the tracking area. If the owner doesn't happen to be
a view in the same hierarchy, it's not guaranteed to have
-updateTrackingAreas called.
Additionally, if the owner is a view, it doesn't receive any information
via -mouse{Entered,Exited,Moved}: or -cursorUpdate: to differentiate its
own mouse actions from those of the tracking area. (Yes, there's the
userInfo property of NSTrackingArea that gets attached to the NSEvent
argument passed to the tracking area owner—*unless* it's a mouse-moved
event in which case it doesn't!).
So is this actually supported? My limited testing indicates it works,
but I would like to know for certain.
--Kyle Sluder
_______________________________________________
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