How to access callback from imported slint file in rust? #2915
Answered
by
ogoffart
kkettinger
asked this question in
General
-
I'm trying to separate all properties and callbacks into a extra slint file called "Backend.slint" like this: export global Backend {
pure callback set-signal(int);
} In my App.slint, the import and usage looks like this: import { Backend } from "Backend.slint";
import { Button } from "std-widgets.slint";
export component App inherits Window {
Button {
clicked => {
Backend.clicked(1);
}
}
} In my fn main() {
/// ....
ui.global::<Backend>().on_clicked(|id| {
println!("On button clicked: id={}", id);
});
/// ....
} But he can't find the
When i move the contents of the import { Button } from "std-widgets.slint";
export global Backend {
pure callback clicked(int);
}
export component App inherits Window {
Button {
clicked => {
Backend.clicked(1);
}
}
} Any idea how to make the |
Beta Was this translation helpful? Give feedback.
Answered by
ogoffart
Jun 16, 2023
Replies: 1 comment 1 reply
-
You can re-export it from the App.slint.
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
kkettinger
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can re-export it from the App.slint.