Custom cursor is reset to system default when hovering over text field.

I working on a macOS application where in some conditions, the cursor has to be set by a custom one.

So far, so good, I'm able to change the NSCursor, but when I hover the mouse over an editable text field, the cursor is changed to the default text edit cursor.

And when I move further, my custom cursor is not comming back...

How can I avoid this ?

Accepted Reply

The short answers:


>> when I hover the mouse over an editable text field, the cursor is changed


You can't change that, at least not easily.


>> my custom cursor is not comming back


Use NSTrackingArea to designate the areas of your view where the cursor should be the custom one.


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

Replies

The short answers:


>> when I hover the mouse over an editable text field, the cursor is changed


You can't change that, at least not easily.


>> my custom cursor is not comming back


Use NSTrackingArea to designate the areas of your view where the cursor should be the custom one.


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

Thank you QuencyMoris,

I defined a NSTrackingArea, and this solved my problem.