3

I have a NSStatusItem and I want to popup a menu by rightclicking the item. I subclassed a NSView and overwrote the - (void)rightMouseDown:(NSEvent *)event method. I also implemented - (void)mouseDown:(NSEvent *)event for looking at the modifierflags. My problem is, that the view does not recieve the NSRightMouseDown-Event. And I don't know why? Any ideas how to get this event? Naturally I added the custom view to the statusitem.

- UPDATE -
Additional information: I have added a NSImageView to my custom view's subviews.

- UPDATE 2 -
Additional information: It conforms to the NSMenuDelegate protocol.

papr
  • 4,717
  • 5
  • 30
  • 38
  • I am puzzled. I just built a short test app, and was able to receive both `mouseDown` and `rightMouseDown` events. Maybe you could give us more information on the design of your `NSView` subclass? – MJeffryes Jan 30 '10 at 22:39
  • Possible duplicate of [Cocoa: Right Click NSStatusItem](https://stackoverflow.com/questions/4565820/cocoa-right-click-nsstatusitem) – BB9z Jan 03 '19 at 13:13

1 Answers1

1

Ok. Problem solved. The problem was the NSImageView. I subclassed it and now I redirect all mouseDown and rigthMouseDown events to its superview (my custom view).

papr
  • 4,717
  • 5
  • 30
  • 38