• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Safe to install NSTrackingArea on a subview?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Safe to install NSTrackingArea on a subview?


  • Subject: Re: Safe to install NSTrackingArea on a subview?
  • From: Quincey Morris <email@hidden>
  • Date: Thu, 15 Nov 2012 18:45:28 -0800

On Nov 15, 2012, at 17:55 , Kyle Sluder <email@hidden> wrote:

> 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.

A comment squirreled away in the Event Handling guide:

	https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/EventOverview/TrackingAreaObjects/TrackingAreaObjects.html

might be relevant to your question. It says:

> "Note that the Application Kit sends updateTrackingAreas to every view whether it has a tracking area or not."

If that's so, there'd only be a difficulty if the owner isn't a view.

> 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!).

If the view to which the tracking area is attached is a subview of the owner, then I'd guess this isn't much of a problem**. In more complicated cases, the owner is likely keeping track of the inside/outside state anyway, which means it can tell the mouse-moved events apart if it needs to (and it can also distinguish them with a straightforward "point in rect" test, can't it?**).


** Assuming the code is careful to convert to the right coordinate system.

_______________________________________________

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


References: 
 >Safe to install NSTrackingArea on a subview? (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Safe to install NSTrackingArea on a subview?
  • Next by Date: Re: Invoking protocol method on the main thread
  • Previous by thread: Safe to install NSTrackingArea on a subview?
  • Next by thread: Storyboard UISplitViewController difficulty
  • Index(es):
    • Date
    • Thread