Mouse click events in NSView subclass

I have an NSView subclass that is initialized with an OpenGL context and has a bunch of mouse event handling (onMouseDown, etc.). I have an application that has a main Cocoa window that contains a view and all mouse events are working correctly.

However, I am trying to use it now in another application where I have a secondary window that pops up and is initialized by the view, and as long as I get the mouse move, I don't see any mouse click (or keyboard for that matter).

When I click and drag the view, the whole window moves and I have to guess why I am not receiving any mouse events. I am taking FirstResponder and taking FirstMouse, returning YES and even having hitTest returning self for good measure.

Do you have any idea what might be wrong?

+2


source to share


1 answer


You need to return NO from -mouseDownCanMoveWindow to your NSView subclass.



+7


source







All Articles