-
Hi, for a log window I want the TextEdit component to automatically scroll down to the most recent content (i.e. the bottom-most lines) whenever the content changes. How would I realise that with Slint/Rust? Example logger.slint (SlintPad version)import { Button, TextEdit } from "std-widgets.slint";
export component Logger inherits Window {
preferred-width: 250px;
preferred-height: 150px;
VerticalLayout {
Button {
private property <int> value: 1;
text: "Add new line";
clicked => {
logger.text += "Line #" + value + " added...\n";
value += 1;
logger.edited(logger.text);
}
}
logger := TextEdit {
read-only: true;
edited => {
// update viewport position???
}
}
}
} |
Beta Was this translation helpful? Give feedback.
Answered by
ogoffart
May 19, 2023
Replies: 2 comments
-
You can use the viewport property of the TextEdit:
I also recommand making a new function rather than re-using the edited callback, but you can still use the edited callback if you like |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Argent77
-
That works great, thanks. |
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
You can use the viewport property of the TextEdit:
I also recommand making a new function rather than re-using the edited callback, but you can still use the edited callback if you like
SlintPad