Need help understanding the difference between one-way and two-way bindings. #7781
Answered
by
ogoffart
coderedart
asked this question in
Q&A
-
import {VerticalBox, Slider } from "std-widgets.slint";
export component Demo inherits VerticalBox {
alignment: start;
property <float> foo;
a := Slider {
minimum: 0;
maximum: 100;
value <=> foo;
changed value => {
debug("a: ", self.value)
}
}
changed foo => {
debug("foo", foo)
}
b := Slider {
minimum: 0;
maximum: 100;
value: foo;
changed value => {
debug("b: ", self.value)
}
}
} Load this snippet on to slintpad and follow the steps:
I have two questions:
|
Beta Was this translation helpful? Give feedback.
Answered by
ogoffart
Mar 3, 2025
Replies: 1 comment 2 replies
-
Basically, the two way binding means the two properties are kind of "merged" in one: change to one impact the other and vice-versa. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, exactly that.
That is really strange. I thin there is a bug there. Maybe the same as #7747