• 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: click through view ?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: click through view ?


  • Subject: Re: click through view ?
  • From: email@hidden
  • Date: Mon, 18 Mar 2002 20:46:53 -0800

Can anyone tell me if it possible to implement an NSView that can be
clicked through such that anything view lying 'underneath' can receive
the click unless the subview of the click through view is hit ? I'm
trying to create a view that is essentially transparent yet houses
subviews, so that if the actual view itself is hit the click is ignored
and passed to the next view in the hierarchy unless a subview is hit of
course.

The doc for -[NSView hitTest:] says:

Returns the farthest descendant of the receiver in the view hierarchy (including itself) that contains aPoint, or nil if aPoint lies completely outside the receiver. aPoint is in the coordinate system of the receiver's superview, not of the receiver itself.

This method is used primarily by an NSWindow to determine which NSView should receive a mouse-down event. You'd rarely need invoke this method, but you might want to override it to have a view object hide mouse-down events from its subviews.

Based upon this, I think overriding hitTest: and returning nil when desired should do what you want. However, I haven't tried; I've overridden hitTest: for other purposes, but I've never done what you suggest. A report to the list on your experiences might be nice!

Ben Haller
Stick Software
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: click through view ?
      • From: RFM <email@hidden>
  • Prev by Date: Re: Newbie with stupid question cont.
  • Next by Date: NSString from .txt file
  • Previous by thread: click through view ?
  • Next by thread: Re: click through view ?
  • Index(es):
    • Date
    • Thread