macOS Responder Chain?

I have an NSWindow, with event handlers for mouse
on that window I have other controls also with mouse event handlers
You can think Xojo hierarchy here … as it should be basically the same

When the control is clicked, based on a flag (think True in MouseDown) , it should either stop the event, or propogate up the chain… to either a parent container, or to the hosting window.

here is the code I have (note : Swift)

internal override func mouseDown(with event: NSEvent)    {
   let _ = zMouseManager!.updateXY(event)
   self.eventDelegate?.eventMouseDown(self,mouseX,mouseY)
   if self.mouseIsHandled == false { print("fwd"); super.mouseDown(with: event);  }
}

the message “fwd” prints at the expected times… but the parent window never seems to get the message

the 1st line simply updates internal CGPoint with the mouse location (returned as mouseX and mouseY)
the 2nd line sends an event which calls the user routine that sets mouseIsHandled (same as the MouseDown event in Xojo)
the 3rd line is supposed to forward that event if the delegate decided not to handle it

SOLVED… by trial and error :slight_smile:

if self.mouseIsHandled == false { print("fwd"); super.nextResponder!.mouseDown(with: event);  }

Because you’re sending the NSEvent to the super class, not the next responder.

Does the super class (or any inherited class) have an override for mouseDown? If so, that may be capturing the event rather than letting it flow through the responder chain.

see above… I figured the nextResponder was required… thanks