Is it possible to get an NSView to pass rightMouseDown: to the next responder without subclassing?

Posted by Benedict Cohen on Stack Overflow See other posts from Stack Overflow or by Benedict Cohen
Published on 2010-06-03T09:50:43Z Indexed on 2010/06/03 9:54 UTC
Read the original article Hit count: 405

Filed under:
|
|
|

I have a view which contains a few subviews:

mainView
    subViewA
    subViewB
    SubViewC

mainView is an NSView constructed from a nib and is controlled with an NSViewController subclass. The subviews are standard views such as NSTextField and NSImageView and are configured to be non-editable. I want mainView to receive rightMouseDown: even when the event is triggered in one of the subviews.

The default implementation of rightMouseDown: in NSResponder passes the event to the next responder, but NSView changes the default behaviour and does not pass it to the next responder.

I could subclass all of the subviews but this doesn't seem like a very elegant or maintainable solution.

How can I get the subviews to pass rightMouseDown: messages to the next responder without subclassing all of the subviews?

© Stack Overflow or respective owner

Related posts about cocoa

Related posts about nsview