Hi Uli,

thanks a lot for the reply!

I tried to override "mouseMoved:", "addCursorRect:cursor:",
"cursorUpdate:", "resetCursorRects", "mouseEntered:" without calling
"super", but the I-beam cursor is still set when it is being moved over
NSTextView.

I also found this in the "Cocoa Event Handling Guide" docs:

Cursor-update events are a special kind of mouse-tracking event that the
> Application Kit handles automatically. When the mouse pointer enters a
> cursor rectangle, the Application Kit displays a cursor image appropriate
> to the type of view under the rectangle; for example, when a mouse pointer
> enters a text view, an I-beam cursor is displayed.
>

One can read the "handles automatically" above as "no easy way to override".

I also think I read somewhere sometime that someone overrode the "mouseMoved:"
method for cursor setting but I cannot find it anymore.

However, I'm not sure I understood your last advice: what "subview" do you
mean? Both the button (or the view holding the button) and the textview are
siblings. If I make the button a subview of the textarea it wont show up at
all..?

In any case, I will try to look into this further so if anyone has an idea
about this, please let me know.


On Sat, Jan 10, 2015 at 3:09 PM, Uli Kusterer <witness.of.teacht...@gmx.net>
wrote:

> On 09 Jan 2015, at 14:19, ecir hana <ecir.h...@gmail.com> wrote:
> > I have a window with a custom view, which contains two children: a
> textview
> > with scrollbars and a button. I would like to overlay the button over the
> > textview so when I click in that area somewhere, the button receives the
> > event before the textview. It kind of works, except for one thing: the
> > cursor is always of the I-beam variety, even when above the button, see
> [1]
> > and [2].
>
>  With a regular view, I would say you just need to create a cursor region
> around your button that overrides the one set by the other view to set an
> arrow, but ISTR that cursor regions that overlap have always been kind of
> unreliable. At least that’s what I’ve found in my testing so far. Sometimes
> they just don’t seem to trigger.
>
>  Another problem seems to be that NSTextView seems to not be using cursor
> views. I have the impression that it just listens for mouseMoved events and
> re-sets the cursor every time. I still haven’t fully figured out what’s
> going on here.
>
>  So in short, you could try to override NSTextView to see if you can get
> it to not set the cursor at all, then make it use cursor regions instead.
> If the overlapping of cursor regions doesn’t work sufficiently well, you
> could make the cursor view aware of the other views’ cursor rects and just
> have it generate a series of rects with the subviews’ rects cut out, then
> only set cursor regions for the remaining views. Maybe you’ll have to
> override mouseMoved: for that, and just not call the inherited method when
> it’s over a subview.
>
> Cheers,
> -- Uli Kusterer
> “The Witnesses of TeachText are everywhere...”
> http://zathras.de
>
>
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to