Skip to main content

Module dialog

Module dialog 

Source
Expand description

Dialog and AlertDialog — modal overlays built on egui::Modal.

Both are controlled by an &mut bool you own. Dialog is a general container with a title + body closure; AlertDialog is a focused confirm/cancel prompt that reports which button was pressed.

if sc::Dialog::new("Edit profile").show(ctx, &mut self.open, |ui| {
    ui.add(sc::Input::new(&mut self.name));
}).is_some() { /* rendered this frame */ }

match sc::AlertDialog::new("Delete file?")
    .description("This cannot be undone.")
    .danger()
    .show(ctx, &mut self.confirm_open)
{
    Some(sc::AlertChoice::Confirm) => { /* delete */ }
    Some(sc::AlertChoice::Cancel) | None => {}
}

Structs§

AlertDialog
A confirm / cancel prompt.
Dialog
A general modal dialog.

Enums§

AlertChoice
Which button an AlertDialog reported.