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