How to change the text of a button when clicked #5312
Answered
by
lucasmerlin
Mikachu2333
asked this question in
Q&A
-
BackgroundAs the title shows, I'd want to make a button to change and show the ProblemI knew how to set the What i wantsth like the following "fake" code shows
q.mp4 |
Beta Was this translation helpful? Give feedback.
Answered by
lucasmerlin
Oct 27, 2024
Replies: 1 comment
-
You'd do something like this: let mut on_top = false;
let text = if on_top {
"Original status (ON TOP)"
} else {
"Status changed (NOT ON TOP)"
}
if ui.button(text).clicked() {
on_top = !on_top;
set_on_top(on_top);
} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
Mikachu2333
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You'd do something like this: