Checkbox: checked property can not be assigned to root property #8022
Unanswered
JaberwockySeamonstah
asked this question in
Q&A
Replies: 2 comments 2 replies
-
Good Morning, thank you for the question. To get this working you need a two way binding A short example import { CheckBox, VerticalBox } from "std-widgets.slint";
export component Demo {
property <bool> checked;
VerticalBox {
alignment: start;
CheckBox {
text: "Check me";
checked <=> root.checked;
toggled => {
debug.text = "";
debug.text += self.checked ? "s.c: true; " : "s.c: false";
debug.text += root.checked ? "r.c: true; " : "r.c: false";
}
}
debug := Text {}
}
} If you want to know more about two-way bindings this is the link to the documentation https://docs.slint.dev/latest/docs/slint/guide/language/concepts/reactivity/#two-way-bindings |
Beta Was this translation helpful? Give feedback.
2 replies
-
I have moved the issue in discussions because it's not a bug. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Bug Description
I try to connect the
checked
property of aCheckBox
to a variable in theroot
of mycomponent
. Despite the value ofchecked
changing, my variable always showsfalse
.Reproducible Code (if applicable)
Environment Details
Product Impact
I'm building an open-source application with slint, it is my first slint project. This issue is a minor one, because there are simple workarounds.
Beta Was this translation helpful? Give feedback.
All reactions