Replies: 1 comment 1 reply
|
Short version: dioxus doesn't have a You can still fake it though. Keep use dioxus_desktop::{use_window, use_wry_event_handler};
use dioxus_desktop::tao::event::{Event, WindowEvent};
let window = use_window();
use_wry_event_handler(move |event, _| {
if let Event::WindowEvent { event: WindowEvent::CloseRequested, .. } = event {
// WindowHides already kept it alive, pull it back into view
window.set_visible(true);
// then trigger your in-app confirm dialog (flip a signal, etc.)
}
});
One honest caveat: it hides-then-reshows in the same tick, so depending on the platform you can get a tiny flicker. That's the cost of there being no real cancel hook today. If you want the clean version, worth a +1 on #2988 so it stays on their radar. |
Uh oh!
There was an error while loading. Please reload this page.
With tauri, I can intercept CloseRequested, and display a confirmation dialog inside the same window while keeping it visible.
But when using dioxus, I'm forced to choose between hiding the window
WindowCloseBehaviour::WindowHidesor destroying the windowWindowCloseBehaviour::WindowCloses.My goals:
All reactions