How to get left and right click events from a button #4317
Answered
by
YgorSouza
UnknownSuperficialNight
asked this question in
Q&A
-
I have this button below that works with left click. How do I make an
Here is a pseudocode example:
|
Beta Was this translation helpful? Give feedback.
Answered by
YgorSouza
Apr 4, 2024
Replies: 1 comment
-
let response = ui.add(Button::new("label"));
if response.clicked() {
// ...
}
else if response.secondary_clicked() {
// ...
} Other methods are listed in the docs. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
emilk
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ui::add
returns aResponse
. You have to assign it to a variable if you want to use it more than once.Other methods are listed in the docs.