Mouse Propagation [SOLVED]

Hello all,

I cannot achieve the following : I just want to add a layer of color above a Qcomponent with a UserView, but it captures the mouse click and all events linked with the component below, despite the ‘false’ return statement.

(
var m = EnvelopeView(nil, Rect(500, 100, 200, 100))
.setEnv(Env.perc)
.action_{arg s;
	"hello".postln
}.front;
UserView(m, Rect(0, 0, 30, 30))
.background_(Color(0.1, 0.4, 0.4, 0.1))
.mouseDownAction_{false};
)

edit : In the doc, it is said

However, returning either true or false will completely bypass the view's C++ implementation,

But it’s not very clear. It will also bypass the parent’s view implementation ??

Maybe you don’t want to accept mouse events for the view:

(
var m = EnvelopeView(nil, Rect(500, 100, 200, 100))
.setEnv(Env.perc)
.action_{arg s;
	"hello".postln
}.front;
UserView(m, Rect(0, 0, 30, 30))
.background_(Color(0.1, 0.4, 0.4, 0.1))
.acceptsMouse_(false);
)
1 Like

It will also bypass the parent’s view implementation ??

Propagating events to parent view is part of the C++ implementation that you are bypassing.

1 Like

ok great, I did not remember this option. It’s perfect, thank you :slight_smile: