Skip to navigation
How can we do modal window in egui
16.02.23
se eframe::egui; #[derive(Default)] struct App { window_open: bool, } impl eframe::App for App { fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) { if self.window_open { egui::Window::new("Modal Window") .open(&mut self.window_open) .show(ctx, |ui| { ui.label("contents"); }); } egui::CentralPanel::default().show(ctx, |ui| { ui.set_enabled(!self.window_open); if ui.button("Open the window").clicked() { self.window_open = true; } }); } } fn main() { eframe::run_native( "Modal window", eframe::NativeOptions::default(), Box::new(|_cc| Box::new(App::default())), ); }
https://github.com/emilk/egui/discussions/1740
Reply
Anonymous
Information Epoch 1732451366
Think parallel.
Home
Notebook
Contact us