Closing an egui menu?

⚓ Rust    📅 2025-06-20    👤 surdeus    👁️ 6      

surdeus

Warning

This post was published 53 days ago. The information described in this article may have changed.

Info

This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Closing an egui menu?

I have an egui application with a menu bar along the top of the window that has a File menu with a few options (egui::menu::bar(ui, |ui| { ui.menu_button("File", |ui| { /* buttons */ }); })). I've noticed that clicking on one of the options in the menu doesn't close it; the menu stays open until you click outside of it or press Esc. Is there any way to get the menu to close after you click an option? I've been perusing the docs and haven't found any reference to a way to explicitly open or close a menu. I also considered the possibility of trying to fake an input event to get it to close, but I haven't found a way to do that either, at least not within egui itself.

4 posts - 2 participants

Read full topic

🏷️ rust_feed