• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Custom mouse cursor in NSTextView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Custom mouse cursor in NSTextView


  • Subject: Re: Custom mouse cursor in NSTextView
  • From: Douglas Davidson <email@hidden>
  • Date: Mon, 23 Jun 2008 12:45:57 -0700


On Jun 13, 2008, at 8:58 AM, Todd Ransom wrote:

I have a fullscreen text view in my app that allows the user to set a foreground and background color. Problem is, for some configurations the default I-beam mouse cursor does not show up very well so I want to provide a custom I-beam cursor in the same color as the text.

I put together a bezier path to draw the I-beam and overrode resetCursorRects like this:

- (void)resetCursorRects
{
[self addCursorRect: [self visibleRect] cursor: [self bigIBeamCursor]];
}



This works great as long as I use it in an NSView subclass. But as soon as I change my class to inherit from NSTextView it stops working. resetCursorRects is still called, but the text view is doing some kind of magic to change the cursor itself. I have also tried overriding - (void)addCursorRect:(NSRect)aRect cursor: (NSCursor *)aCursor to replace the generic ibeam with my own, but that only seems to get called if I override resetCursorRects and it does not affect the cursor appearance in the text view either.


Has anyone else out there successfully changed the mouse cursor on a text view? What did you need to do?

NSTextView sets the cursor over itself dynamically, based on considerations including the text under the cursor. It does so in - mouseEntered:, -mouseMoved:, and -cursorUpdate:, so those would be points to consider overriding.


Douglas Davidson

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


References: 
 >Custom mouse cursor in NSTextView (From: Todd Ransom <email@hidden>)

  • Prev by Date: Re: Learning SQLite by watching Core Data?
  • Next by Date: caching NSCollectionView
  • Previous by thread: Custom mouse cursor in NSTextView
  • Next by thread: [NSOutlineView/NSTableView] Returning nil enables auto-edition?
  • Index(es):
    • Date
    • Thread