-
There doesn't seem to be a way to do this from what I've seen. |
Beta Was this translation helpful? Give feedback.
Answered by
YgorSouza
May 24, 2024
Replies: 1 comment 1 reply
-
I don't think there is an API that tells you directly if the cursor changed, but you can get the current value and then compare to the previous value that you stored somewhere. impl eframe::App for MyApp {
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
egui::CentralPanel::default().show(ctx, |ui| {
let id = "prev-cursor".into();
let previous_range = ui.data(|data| data.get_temp(id));
let range = egui::TextEdit::singleline(&mut self.name)
.show(ui)
.cursor_range;
ui.strong(format!(
"Changed: {}",
previous_range.unwrap_or(range) != range
));
ui.label(format!("{range:?}"));
ui.data_mut(|data| data.insert_temp(id, range));
});
}
} Screencast.from.2024-05-24.21-08-41.mp4 |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
doonv
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't think there is an API that tells you directly if the cursor changed, but you can get the current value and then compare to the previous value that you stored somewhere.