Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Chirone

macrumors 6502
Original poster
Mar 2, 2009
279
0
NZ
this may or may not be simple

i want to know when the user has right or middle clicked on a view.

you'd think it be as easy as just overriding the -(void)rightMouseDown: method... but it doesn't trigger... :confused:

i thought maybe i have to make - (void)acceptsFirstMouse: return YES, but that method is never called

i even tried overriding the - (NSMenu*)menuForEvent: and + (NSMenu*)defaultMenu methods but those never get called either.

and yes, the view is at the top and it is the first responder. It responds to mouseDown: and it's set up to respond to mouseMoved:

what am I missing?
 
Post your code.

I made a new empty project, rightMouseDown: and mouseDown: get called just fine with no extra code.

What OS?
 
i made an empty project as well and i could right click and pick up the event

makes me wonder what happened in the bigger project.

in the bigger project the view is a subview of a view that's inside a clipview of a scrollview.

upon further experiments i've found that the view that should be receiving right clicks will indeed receive them but only if i don't add the two subviews that are sitting on it.

However, this doesn't make much sense to me as it receives mouseDown events easily and the two subviews don't even cover the entire view that is meant to receive right clicks.

the two little subviews also have no code that passes on the mouse events to their super view...
 
i made an empty project as well and i could right click and pick up the event

makes me wonder what happened in the bigger project.

in the bigger project the view is a subview of a view that's inside a clipview of a scrollview.

upon further experiments i've found that the view that should be receiving right clicks will indeed receive them but only if i don't add the two subviews that are sitting on it.

However, this doesn't make much sense to me as it receives mouseDown events easily and the two subviews don't even cover the entire view that is meant to receive right clicks.

the two little subviews also have no code that passes on the mouse events to their super view...


Right mouse clicks only go to the topmost view and are not passed along the responder chain.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.