• 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: Best Control for Catching a Mouse Click?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Best Control for Catching a Mouse Click?


  • Subject: Re: Best Control for Catching a Mouse Click?
  • From: Jens Alfke <email@hidden>
  • Date: Mon, 07 Dec 2015 09:21:32 -0800

> On Dec 7, 2015, at 8:32 AM, Dave <email@hidden> wrote:
>
> If the User Clicks anywhere inside the base NSView, I’d like a Perform Click IBAction to be sent to the connected class (The View Controller in this case).

Make the base view a custom subclass of NSView, and override -hitTest: to return self. This will short-circuit the regular delivery of mouse events so they always go to the parent view. Then you can override -mouseDown: etc. to do whatever you want, like message the view controller.

Read the API docs of -hitTest:, or the “hit testing” section of the event handling guide, for more details.

—Jens

_______________________________________________

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: 
 >Best Control for Catching a Mouse Click? (From: Dave <email@hidden>)

  • Prev by Date: Re: How to create an empty stack view in code
  • Next by Date: Re: UIView underlying rects for drawRect
  • Previous by thread: Re: Best Control for Catching a Mouse Click?
  • Next by thread: Non-Resizable Window and Autolayout
  • Index(es):
    • Date
    • Thread