-
Hi there, I'd like to return the text in a StandardListViewItem when said item is clicked. Many thanks for any suggestions, though I'm still getting used to it this is a very nice toolkit to work with. 😄 |
Beta Was this translation helpful? Give feedback.
Answered by
ogoffart
Mar 28, 2024
Replies: 1 comment 1 reply
-
There is a Example: import { StandardListView } from "std-widgets.slint";
export component Example inherits Window {
width: 150px;
height: 150px;
StandardListView {
width: 150px;
height: 150px;
model: [ { text: "Blue"}, { text: "Red" }, { text: "Green" },
{ text: "Yellow" }, { text: "Black"}, { text: "White"},
{ text: "Magenta" }, { text: "Cyan" },
];
item-pointer-event(i, ev) => {
if ev.button == PointerEventButton.left && ev.kind == PointerEventKind.up {
debug(self.model[i].text);
}
}
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
Dirleye
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is a
item-pointer-event
callback in StandardListView which you can use for that: https://slint.dev/releases/1.5.1/docs/slint/src/language/widgets/standardlistview#callbacksExample: