• 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: never called in NSView subclass
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rightMouseDown: never called in NSView subclass


  • Subject: Re: rightMouseDown: never called in NSView subclass
  • From: Corbin Dunn <email@hidden>
  • Date: Thu, 25 Aug 2011 15:27:21 -0700

ToolbarView overrides hitTest; to do some magic; that is probably the source of your problem.

What are you trying to do?

corbin

On Aug 25, 2011, at 3:14 PM, Indragie Karunaratne wrote:

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

_______________________________________________

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: never called in NSView subclass
      • From: Indragie Karunaratne <email@hidden>
References: 
 >rightMouseDown: never called in NSView subclass (From: Indragie Karunaratne <email@hidden>)
 >Re: rightMouseDown: never called in NSView subclass (From: Kyle Sluder <email@hidden>)
 >Re: rightMouseDown: never called in NSView subclass (From: Indragie Karunaratne <email@hidden>)
 >Re: rightMouseDown: never called in NSView subclass (From: Ken Thomases <email@hidden>)
 >Re: rightMouseDown: never called in NSView subclass (From: Indragie Karunaratne <email@hidden>)

  • Prev by Date: Re: rightMouseDown: never called in NSView subclass
  • Next by Date: Re: rightMouseDown: never called in NSView subclass
  • Previous by thread: Re: rightMouseDown: never called in NSView subclass
  • Next by thread: Re: rightMouseDown: never called in NSView subclass
  • Index(es):
    • Date
    • Thread