In OS X version 10.3 and later, cursor size is no longer limited to 16 by 16 pixels.

Cursor Rectangles

In Cocoa, you can change the currently displayed cursor based on the position of the mouse over one of your views. You might use this technique to provide visual feedback about what actions the user can take with the mouse. For example, you might display one of the resize cursors whenever the mouse moves over a portion of your view that acts as a custom resizing handle. To set this up, you associate a cursor object with one or more cursor rectangles in the view.

Cursor rectangles are a specialized type of tracking rectangles, which are used to monitor the mouse location in a view. Views implement cursor rectangles using tracking rectangles but provide methods for setting and refreshing cursor rectangles that are distinct from the generic tracking rectangle interface. For information on how to set up cursor rectangles, see Mouse-Tracking and Cursor-Update Events.

Balancing Cursor Hiding and Unhiding

Each call to hide cursor must have a corresponding unhide call. For example,

[NSCursorhide];

[NSCursorhide];

….

[NSCursorunhide];

Will result in the cursor still being hidden because the hide and unhide method invocations are not balanced. Instead you must balance the method calls, such as in the following example:

[NSCursorhide];

[NSCursorhide];

….

[NSCursorunhide];

[NSCursorunhide];

There are corresponding cursor hide and unhide calls, thus the cursor will become visible.

Import Statement

Availability

See Also

Returns a Boolean value indicating whether the receiver becomes current on receiving a mouseEntered: message.

Declaration

Objective-C

- (BOOL)isSetOnMouseEntered

Return Value

YEStrue if the receiver will become current when it receives a mouseEntered: message; otherwise, NOfalse.

Discussion

To receive such a message, the receiver must first be assigned a cursor rectangle. This assignment can be made using the NSView method addCursorRect:cursor:. For a more complete explanation, see the class description.

Import Statement

Availability

Returns a Boolean value indicating whether the receiver becomes current when it receives a mouseExited: message.

Declaration

Objective-C

- (BOOL)isSetOnMouseExited

Return Value

YEStrue if the receiver becomes current when it receives a mouseExited: message; otherwise, NOfalse.

Discussion

To receive such a message, the receiver must first be assigned a cursor rectangle. This assignment can be made using the NSView method addCursorRect:cursor:. For a more complete explanation, see the class description.

Declaration

Constants

NSAppKitVersionNumberWithCursorSizeSupport

NSAppKitVersionNumberWithCursorSizeSupport

The specific version of the AppKit framework that introduced support for cursors larger than 16 x 16 pixels in size. Developers should not need to use this constant unless they are writing applications for OS X v10.2 and earlier.