Re: Setting cursor for subview of NSTextView
Re: Setting cursor for subview of NSTextView
- Subject: Re: Setting cursor for subview of NSTextView
- From: email@hidden (Stefan Haller)
- Date: Sat, 13 Mar 2010 17:11:56 +0100
Martin Wierschin <email@hidden> wrote:
> > I have a custom NSTextAttachmentCell that does its work by adding
> > subviews to the NSTextView (e.g. NSButtons). This works fine.
> >
> > What I can't get to work is cursor handling; I always get an arrow
> > cursor when the mouse is over my views. I overwrite resetCursorRects,
> > like this:
> ...
> > This doesn't help. Getting desperate, I tried implementing
> > mouseMoved:, but it's not even called
>
> Overriding mouseMoved is unfortunately required if you want to
> customize the mouse cursor in NSTextView (see this post by the helpful
> Mr Davidson).
What I missed was that in order to receive mouseMoved events, you need
to set a tracking area first; I had assumed that mouseMoved: is
automatically called for the deepest view under the mouse that
implements it. (Reading the docs can help at times...)
After overriding updateTrackingAreas in my subview and installing a
suitable NSTrackingArea, things work in most situations; I then still
had to override mouseMoved: in the NSTextView though, and keep it from
calling super if the subview had set the cursor, otherwise the cursor
would still be reset to an arrow in certain cases.
Thanks for the help (also to Douglas, who sent me private mail).
-Stefan
--
Stefan Haller
Berlin, Germany
http://www.haller-berlin.de/
_______________________________________________
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