Replies: 3 comments
-
Unfortunately we don’t have a mechanism yet to access these from outside the loop. So pushing or pulling information from the inside works, but not from the outside. IMO we’re missing the concept of a weak reference in the language and how to deal with it when it can’t be upgraded to a strong one. We‘ve discussed an option type here, and that might be a path. As long as any attempt to reference is guarded, in the eyes of the developer. |
Beta Was this translation helpful? Give feedback.
-
This is not possible to reference inner control. import { AboutSlint, Button, VerticalBox, ListView, LineEdit } from "std-widgets.slint";
export component Demo {
property <string> to-focus;
VerticalBox {
Button {
text: "Focus on Lithium";
clicked => {
to-focus = "Lithium"
}
}
ListView {
for text in ["Hydrogen", "Helium", "Lithium", "Beryllium"] : line-edit := LineEdit {
text: text;
property <bool> should-get-focus: to-focus == text;
changed should-get-focus => {
if should-get-focus {
self.focus();
to-focus = "";
}
}
}
}
}
} |
Beta Was this translation helpful? Give feedback.
-
This technique is not the most beautiful thing in the world, but it is not the worst. And most importantly, it works :-) Thanks! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Is there a way to reference controls generated by repetition, like the below?
Beta Was this translation helpful? Give feedback.
All reactions