Copy text to clipboard with button push #1321
-
|
How can I copy some text to the clipboard with a button push? I tried importing if ui.button("📋").clicked() {
let mut ctx = ClipboardContext::new().unwrap();
ctx.set_contents(sometext.to_string()).unwrap();
}but this does not work for me (clipboard is not updated). For some reason: if ui.button("📋").clicked() {
let mut ctx = ClipboardContext::new().unwrap();
ctx.set_contents(sometext.to_string()).unwrap();
ctx.get_contents().unwrap();
}does sort-of work, but I tried searching for a way to get a handle of |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
|
I believe what you're looking for is |
Beta Was this translation helpful? Give feedback.
-
|
egui 0.31.1 changes follow this way if ui.button("📋").clicked() {
ui.ctx().copy_text(self.text.clone());
} |
Beta Was this translation helpful? Give feedback.
I believe what you're looking for is