Establishes an area for tracking mouse-entered and mouse-exited events within the view and returns a tag that identifies the tracking rectangle.
- macOS 10.0+
A rectangle that defines a region of the view for tracking mouse-entered and mouse-exited events.
Data stored in the
NSEventobject for each tracking event.
true, the first event will be generated when the cursor leaves
a, regardless if the cursor is inside
awhen the tracking rectangle is added. If
falsethe first event will be generated when the cursor leaves
aif the cursor is initially inside
a, or when the cursor enters
aif the cursor is initially outside
a. You usually want to set this flag to
A tag that identifies the tracking rectangle. It is stored in the associated
NSEvent objects and can be used to remove the tracking rectangle.
Tracking rectangles provide a general mechanism that can be used to trigger actions based on the cursor location (for example, a status bar or hint field that provides information on the item the cursor lies over). To simply change the cursor over a particular area, use
add. If you must use tracking rectangles to change the cursor, the
NSCursor class specification describes the additional methods that must be invoked to change cursors by using tracking rectangles.
In macOS 10.5 and later, tracking areas provide a greater range of functionality (see