![]() Here is how you can change the color: // change the insertion caret to another color Turns out your question was talking about the CARET of the text field, which is the insertion point of the text and different from the mouse cursor. That is, you'll need to override mouseEntered and possibly becomeFirstResponder as well, and include a tracking area to track the cursor as it crosses into your text field. The important thing to remember is that you should use a subclassed NSTextField which keeps track of where the cursor is, so it can set the custom cursor or the cursor color when the mouse enters and moves around your text field. You can probably do that by implementing the setPointerColor:(NSColor *)newColor function found in this blog post on a NSCursor subclass that contains the cursor you want to colorize. It's based on the solutions found in this very related question.Īnd then after doing this work, I realized that what you may simply want is to merely color an existing cursor. ![]() I spent some time just now writing a small sample project that customizes the cursor (which happens to be a color heart icon :-), and you can find it here. ![]() ![]() There's a couple ways to approach this problem.
0 Comments
Leave a Reply. |