I have multiple superposed controls which can handle a mouse click under certain conditions. What I want to be able to do is:
- The top control receives the
mouseDown:
event. - The top control decides if it handles the
mouseDown:
event. - If it does, do something and prevent other controls from receiving the
mouseDown:
event. - If it does not, send the event to the control that's underneath.
- This control decides if it handles the event.
- etc.
In essence I'm trying to send the event to the control whose "Z-Order" is just below the top control, without the top control needing to know about the other controls or needing some special setup at instantiation.
The first thing that came to my mind was to send the event to [topControl nextResponder]
but it seems the nextResponder
for all controls on the window is the window itself and not a chain of controls based on their Z-Order as I previously thought.
Is there a way to do this without resorting to setting the next responder manually? The goal is to get a control which is independent from the other controls and can just be dropped on a window and work as expected.
Thanks in advance!