Replies: 3 comments
-
it's even weirder. If I have a button on the top level, that sets the full example for copy-paste convenient... same as above, but with one extra Button at the end. import { AboutSlint, Button, VerticalBox } from "std-widgets.slint";
import { StandardListView } from "std-widgets.slint";
component U2mSourceList {
in-out property<int> selected: list.current-item;
in property<[StandardListViewItem]> sources: [
{text: "Ui Designer Data 1"},
{text: "Ui Designer Data 2"},
{text: "Ui Designer Data 3"},
{text: "Ui Designer Data 4"},
];
list := StandardListView {
model: sources;
}
}
component U2mSourceDetail {
in property<int> showing: 0;
in property <[string]> sources: [
"Ui Designer Data 1",
"Ui Designer Data 2",
"Ui Designer Data 3",
"Ui Designer Data 4",
];
Text { text: sources[showing]; }
}
export component Demo {
height: 400px;
width: 500px;
GridLayout {
sources := U2mSourceList {
min-width: 100px; max-width: 600px; horizontal-stretch: 0.2;
row: 0; col: 0;
rowspan: 2;
//selected: 1; // if this line is present, interaction is broken.
}
U2mSourceDetail {
min-width: 200px; horizontal-stretch: 0.8;
row: 0; col: 1;
showing: sources.selected;
}
Button { row: 2; text: "set selected=2"; clicked =>{ sources.selected=2; } } // interaction works until this is clicked.
}
} |
Beta Was this translation helpful? Give feedback.
-
After searching the docs for all words related to bidirectional i finally did the same here instead and found the answer: |
Beta Was this translation helpful? Give feedback.
-
I have one component property tied to another one that is tied to a list current-item.
It works fine and the interaction is what one expect. But if I set that property, the interaction breaks.
The same doesn't happen If I don't use components' properties.
This, without components' properties, works fine:
Now, what I think is almost the same bindings, don't work:
Am I doing something wrong there? or is there a work around?
Beta Was this translation helpful? Give feedback.
All reactions