I have a container and listener "click" on it. Inside this container I have a checkbox. If I click on the checkbox the listener function of the container is called. Is there a way to not trigger a listener of the container clicking on the checkbox?
There is code which could be executed on qooxdoo playground:
// Create a button
var button1 = new qx.ui.form.CheckBox();
const container = new qx.ui.container.Composite(new qx.ui.layout.Canvas);
container.setDecorator("main");
container.addListener("click", function(){
console.log("aaaa");
}, this);
container.setWidth(50);
container.setHeight(50);
container.add(button1);
// Document is the application root
var doc = this.getRoot();
// Add button to document at fixed coordinates
doc.add(container,
{
left : 100,
top : 50
});
3
Answers
This is a bit kludgy and doesn’t quite answer your question, but it does allow you to detect that the button handler already handled the event. Maybe this is adequate for your purposes?
I’m thinking along the same lines as Derrell, except no need to add anything special to the checkbox or the next control you add.
Yes, we can stop that using stopPropagation() method of the events objects.
Updated Code: