On Apr 19, 2009, at 15:20, Erik Österlund wrote:

1. What is the difference between tracking areas and tracking rects?

Tracking rects are available pre-Leopard. NSTrackingArea was introduced in Leopard to fix significant problems that made tracking rects pretty much useless for anything but the simplest cases.

2. If I register a tracking rect, will the mouseMoved: message keep on spamming, or will only mouseEntered: and mouseExited: be sent?

Tracking rects have no effect on the production of mouseMoved messages.

If I understood this correctly, all three are activated with the setAcceptsMouseMovedEvents: message.

No, setAcceptsMouseMovedEvents is something else again.

If you're not using NSTrackingArea, or if the mouse isn't inside a NSTrackingArea, you'll get "old-style" mouseMoved events if setAcceptsMouseMovedEvents: YES has been called for the window. Pre- Leopard, this was the only way to get mouseMoved events.

If the mouse is inside a NSTrackingArea, you'll get "new-style" mouseMoved events instead. To prevent confusion, you'd almost certainly never call setAcceptsMouseMovedEvents: YES if you're using NSTrackingArea.

3. What happens if two rects intersect?

If you're asking about tracking rects, there were supposed to be rules about which one won, but I don't recall you could ever rely on it working properly in all cases.

Which one will be called?

If you asking about NSTrackingArea, all of the relevant areas respond. You're responsible for choosing which ones should really do something.

Is it possible to create tree-like priorities like views and subviews?

Not with NSTrackingArea. Keep in mind that mouseEntered/mouseExited/ mouseMoved are sent to the tracking area's owner, regardless of the view/subview structure. (OTOH cursorUpdate is sent to the topmost view under the mouse pointer, regardless of the tracking area's owner.)


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to