• 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: Mouse cursors and overlapping sibling NSViews
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mouse cursors and overlapping sibling NSViews


  • Subject: Re: Mouse cursors and overlapping sibling NSViews
  • From: Ken Thomases <email@hidden>
  • Date: Wed, 23 Apr 2014 18:58:46 -0500

On Apr 23, 2014, at 9:39 AM, Sean McBride wrote:

> Is hitTest: used for cursors as well as clicks?  I put a breakpoint to test the theory, and indeed I see in a backtrace [NSWindow(NSCarbonExtensions) _setCursorForMouseLocation:]

-hitTest: should be used for anything which needs to determine which view a mouse location is associated with.


>> So, you might try overriding -hitTest: for the superview and
>> implementing the logic you prefer.
>
> How would I distinguish being in hitTest: because of a mouse click vs because of a cursor set?  Check the current event type?

Why do you want to distinguish that?  If the cursor is appropriate for a given view, that's a *strong* indication to the user that a click will act on that view.  So, the view controlling the cursor at a given point should also be the view that receives the click at that point.

Another thing you can try, depending on what's actually in the sibling views, is to have the superview take over all mouse events.  Have its -hitTest: return itself or nil, never a subview (even indirectly by invoking -hitTest: on its subviews or super).  Then it controls both the cursor and the response to clicks.

Regards,
Ken


_______________________________________________

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


  • Follow-Ups:
    • Re: Mouse cursors and overlapping sibling NSViews
      • From: Quincey Morris <email@hidden>
References: 
 >Mouse cursors and overlapping sibling NSViews (From: Sean McBride <email@hidden>)
 >Re: Mouse cursors and overlapping sibling NSViews (From: Ken Thomases <email@hidden>)
 >Re: Mouse cursors and overlapping sibling NSViews (From: Sean McBride <email@hidden>)

  • Prev by Date: Re: NSToolbarItem view set to NSButton view, but not showing...
  • Next by Date: Re: NSToolbarItem view set to NSButton view, but not showing...
  • Previous by thread: Re: Mouse cursors and overlapping sibling NSViews
  • Next by thread: Re: Mouse cursors and overlapping sibling NSViews
  • Index(es):
    • Date
    • Thread