Skip to content
Discussion options

You must be logged in to vote

What you are probably looking for is the clicked callback on the button. Here is an example of basic usage withing slint in the docs: https://slint.dev/releases/1.1.1/docs/slint/src/recipes/recipes.

For doing something from the Rust code when a button is clicked you would want to handle the on_mybutton_clicked callback in the rust code.

let btn_handle = main.as_weak();
    main.on_minimize_window(move || {
        let v= btn_handle .upgrade().unwrap();
        //logic on button pressed here
    });
});

You could see some more examples in my code [https://github.com/Vadoola/Tomotroid/blob/main/src/main.rs](here: https://github.com/Vadoola/Tomotroid/blob/main/src/main.rs)

or look at the ma…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by pparaxan
Comment options

You must be logged in to vote
1 reply
@Vadoola
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants