Disable NSView mousedown
-
25-05-2021 - |
Domanda
i have an NSScrollView with an NSView set as its document view. I am trying to get the mousedown event in the NSScrollView but the NSView keeps intercepting it. Is there a way of stopping this from happening?
Also is there a way of stopping it in one area of the view much like an NSTrackingArea does for mouseentered.
Thanks in advance,
Ben
Soluzione
Can you override -mouseDown:
in your subview to just forward the event to the next responder?
You can also this by overriding the superview's -hitTest:
to return either itself (when you don't want subviews to receive events) or a subview (in all other cases where a subview contains the event location).
As regards your last question, you can accomplish this with -hitTest:
as well. Just return self
if the event occurs in a subview's "exclusion zone."
If you go this route, be sure to pay attention to the coordinate system in use at any given time and convert between them as needed.