Intercepting mouse clicks when child components are buttons?

So I’m working on a step sequencer, trying to implement clicking and dragging to ‘select’ step components. I have Track components, which each have an OwnedArray of Step components (which are a subclass of ShapeButton). I’ve overridden the mouseDown and mouseDrag functions in my Track class but these aren’t getting called when the mouse is clicked over one of the Step button components. I’ve tried setInterceptsMouseClicks(true, true); in the constructor for the Track but the mouse event functions still aren’t getting called. Is this an issue with the Steps components being stored in an OwnedArray rather than direct children of the track? Or is there something I’m missing about how the components’ mouse listeners work? Thanks for any ideas of what might be the issue

the buttons are intercepting the mouse events, so your tracks components won’t receive them.
To get them in the trackComponent, register it has a mouse listener to the buttons:

     childButton->addMouseListener (this);
1 Like

Oh thank you, so does the track component need to derive from MouseListener?

the Component class already derives from MouseListener IIRC