Expand description
A message dialog.
use ratatui::buffer::Buffer;
use ratatui::prelude::Rect;
use ratatui::widgets::{Block, StatefulWidget};
use rat_event::{Dialog, HandleEvent, Outcome};
use rat_widget::msgdialog::{MsgDialog, MsgDialogState};
let mut state = MsgDialogState::new_active(
"Warning",
"This is some warning etc etc");
MsgDialog::new()
.block(Block::bordered())
.render(area, buf, &mut state);
// ...
match state.handle(event, Dialog) {
Outcome::Continue => {}
Outcome::Unchanged | Outcome::Changed => { return; }
};
The trick to make this work like a dialog is to render it as the last thing during your rendering and to let it handle events before any other widgets.
Then it will be rendered on top of everything else and will
react to events first if it is active
.
Structs§
- MsgDialog
- Basic status dialog for longer messages.
- MsgDialog
State - State & event handling.
- MsgDialog
Style - Combined style.
Functions§
- handle_
dialog_ events - Handle events for the MsgDialog.