Just realized something interesting, and remembered a key detail that I forgot 
to mention. The view in question is a custom view inside the toolbar of the 
window. The NSToolbar by default has a contextual menu that appears when the 
customizable property is set to YES. However, even though there is no menu when 
customizable is set to NO, I suspected that it was still trapping right mouse 
events. So I used a category on the private NSToolbarView class that manages 
the UI for NSToolbar to check whether it was receiving the events:

@interface NSToolbarView : NSView
@end

@interface NSToolbarView (RightMouse)
@end

@implementation NSToolbarView (RightMouse)

- (void)rightMouseDown:(NSEvent*)theEvent
{
    NSLog(@"right mouse");
}

@end

And as expected, the method is called. This leaves me wondering how the toolbar 
view can receive the events when my own view inside the toolbar can not (as the 
event would have to be forwarded up the responder chain to the toolbar in order 
for it to receive it). 

On 2011-08-25, at 1:58 PM, Ken Thomases wrote:

> On Thu, Aug 25, 2011 at 11:45 AM, Indragie Karunaratne 
> <cocoa...@indragie.com> wrote:
> 
>> I have an NSView subclass that I'm trying to capture right clicks in. I 
>> override the rightMouseDown: method but it is never called.
> 
> Any chance you simply have a typo or misspelling in your method signature?
> 
> -Ken
> 

_______________________________________________

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