• 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: RFM <email@hidden>
  • Date: Tue, 19 Mar 2002 07:09:50 -0500
  • Organization: RFM & Associates

Yep, that worked. This is what I did:

- (NSView*)hitTest:(NSPoint)point
{
NSView *hitView = [super hitTest:point];
// if the view clieck was self then ignore the click by returning nil
return (hitView == self) ? nil : hitView;
}

Thanks for the hint.
Regards,
Bob

email@hidden wrote:

> > 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.

References: 
 >Re: click through view ? (From: email@hidden)

  • Prev by Date: Re: Stop a NSTask
  • Next by Date: Re: NSButton setKeyEquivalent: leaving funny color?
  • Previous by thread: Re: click through view ?
  • Next by thread: Re: Newbie with stupid question cont.
  • Index(es):
    • Date
    • Thread