Howdy,

NSView doesn't call up the responder chain for rightMouseDown:. It calls 
-menuForEvent:, and if non nil, presents the contextual menu.

Please log a bug requesting our documentation to clarify this, or asking us to 
change the behavior if you were expecting something else.

corbin


On Jan 22, 2010, at 12:56 PM, Murat Konar wrote:

> I've run into a surprising behavior today in Leopard 10.5.8 (haven't had the 
> opportunity to test it on Snow Leopard yet).
> 
> I have one view of class "RedView" nested inside another view "OrangeView". 
> Both views are subclasses of NSView.
> 
> This is  the inner view's implementation of rightMouseDown:
> 
> - (void) rightMouseDown:(NSEvent*)event
> {
>    NSBeep();
>    NSLog(@"right mouse down in view %@, nextresponder %@", self, 
> self.nextResponder);
>    [super rightMouseDown:event];
> }
> 
> 
> This is the outer view's implementation:
> 
> - (void) rightMouseDown:(NSEvent*)event
> {
>    NSBeep();
>    NSLog(@"right mouse down in view %@", self);
> }
> 
> Note that the inner view's implementation of rightMouseDown: calls through to 
> the default implementation.
> 
> I expected that a right click in the inner view would be logged by the inner 
> view, and this is the case. However, I also expected the outer view to log 
> the right click as well, since the inner view's implementation calls through 
> to the default implementation, and (according to the docs) the default 
> implementation calls the next responder's implementation, and the next 
> responder is the outer view. But this is *not* the case.
> 
> To wit, here is the output when I right click three times in the outer view, 
> then three times in the inner view:
> 
> 2010-01-22 12:39:56.061 RightMouseTest[26543:813] right mouse down in view 
> <OuterView: 0x1375d0>
> 2010-01-22 12:39:57.151 RightMouseTest[26543:813] right mouse down in view 
> <OuterView: 0x1375d0>
> 2010-01-22 12:39:57.995 RightMouseTest[26543:813] right mouse down in view 
> <OuterView: 0x1375d0>
> 2010-01-22 12:39:59.671 RightMouseTest[26543:813] right mouse down in view 
> <InnerView: 0x1309c0>, nextresponder <OuterView: 0x1375d0>
> 2010-01-22 12:40:00.841 RightMouseTest[26543:813] right mouse down in view 
> <InnerView: 0x1309c0>, nextresponder <OuterView: 0x1375d0>
> 2010-01-22 12:40:01.606 RightMouseTest[26543:813] right mouse down in view 
> <InnerView: 0x1309c0>, nextresponder <OuterView: 0x1375d0>
> 
> 
> As is plain to see, even though the inner view calls through to the defualt 
> implementation, which in turn should pass control to the nextResponder, this 
> is not happening.
> 
> For what it's worth, I also implemented otherMouseButton: in a similar way 
> and it works as expected.
> 
> Is this a bug or what? Any insight appreciated, sample project at:
> 
> <http://codeshare.muratnkonar.com/RightMouseTest.zip>
> 

_______________________________________________

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