• 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: rightMouseDown not working as documented?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rightMouseDown not working as documented?


  • Subject: Re: rightMouseDown not working as documented?
  • From: Corbin Dunn <email@hidden>
  • Date: Fri, 22 Jan 2010 16:20:43 -0800

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 (email@hidden)

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: rightMouseDown not working as documented?
      • From: "email@hidden" <email@hidden>
    • Re: rightMouseDown not working as documented?
      • From: Jens Alfke <email@hidden>
References: 
 >rightMouseDown not working as documented? (From: Murat Konar <email@hidden>)

  • Prev by Date: Re: View Handling
  • Next by Date: Question regarding response time between UIScrollView and UIButton
  • Previous by thread: rightMouseDown not working as documented?
  • Next by thread: Re: rightMouseDown not working as documented?
  • Index(es):
    • Date
    • Thread