Earlier I did try mouseDown:, and it did capture all the clicks (which is what I wanted), but I was not sure on how to implement it. How would I override it so that clicks would not pass through to the superview?

On 2009-09-28, at 8:07 PM, Kyle Sluder wrote:

On Sun, Sep 27, 2009 at 7:36 PM, PCWiz <pcwiz.supp...@gmail.com> wrote:
I have a transparent black NSView that I layer over my window using NSView's addSubview method. This works fine, but I want to make it so that all clicks are captured by the NSView, because right now I can click through to the superview underneath. I've already tried returning NO for acceptsFirstMouse
and it has no effect.

-acceptsFirstMouse: (note the colon) has nothing to do with this.
That determines whether clicking on the control when the window is not
main will cause the event to be dispatched to that view or if it will
simply be dropped on the floor when the window activates.  Typically,
UI controls that could cause destructive changes (like a Delete
toolbar item) return NO, whereas non-destructive controls (like the
toolbar show/hide widget in the titlebar) return YES.

Have you followed Mike Abdullah's advice and overridden -mouseDown:?
The documentation for this method describes exactly why you are seeing
what you are seeing.  In fact, I would have expected that to be the
first thing you would have tried.  If it wasn't, maybe it's worth
seeing if the documentation can be improved to nudge people in this
direction in the future.

--Kyle Sluder

_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to