pub struct MessageBoxButtons {
pub yes: bool,
pub no: bool,
pub ok: bool,
pub cancel: bool,
}Expand description
The set of buttons to show in a message box.
Each field, when set, adds one button along the bottom of the dialog. They
always appear in [Yes, No, OK, Cancel] order regardless of which are enabled.
The value returned by Program::message_box is the Command of the
button the user pressed.
Use one of the convenience constructors for the most common combinations:
| Constructor | Buttons | Use when |
|---|---|---|
ok() | OK | informational notice (only one choice) |
ok_cancel() | OK, Cancel | confirm / discard |
yes_no() | Yes, No | binary decision without escape |
yes_no_cancel() | Yes, No, Cancel | save-before-close |
For an unusual combination use struct-update syntax:
MessageBoxButtons { yes: true, cancel: true, ..Default::default() }.
§Turbo Vision heritage
Replaces the C++ mfOKButton/mfCancelButton/mfYesButton/mfNoButton
flags packed into the high byte of aOptions (msgbox.cpp). The type is
now a struct-of-bools; mfOKCancel/mfYesNoCancel
shorthands become named constructors.
Fields§
§yes: boolShow a “~Y~es” button (fires Command::YES).
Use for binary decisions or save-before-close dialogs.
no: boolShow a “~N~o” button (fires Command::NO).
Pair with yes for a binary decision; add cancel to allow escape.
ok: boolShow an “O~K~” button (fires Command::OK).
The most common single-button choice for informational or confirmation
dialogs. Do not combine with yes/no in the same dialog.
cancel: boolShow a “~C~ancel” button (fires Command::CANCEL).
Always safe to add — allows the user to dismiss without taking action.
Implementations§
Trait Implementations§
Source§impl Clone for MessageBoxButtons
impl Clone for MessageBoxButtons
Source§fn clone(&self) -> MessageBoxButtons
fn clone(&self) -> MessageBoxButtons
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for MessageBoxButtons
Source§impl Debug for MessageBoxButtons
impl Debug for MessageBoxButtons
Source§impl Default for MessageBoxButtons
impl Default for MessageBoxButtons
Source§fn default() -> MessageBoxButtons
fn default() -> MessageBoxButtons
impl Eq for MessageBoxButtons
Source§impl PartialEq for MessageBoxButtons
impl PartialEq for MessageBoxButtons
impl StructuralPartialEq for MessageBoxButtons
Auto Trait Implementations§
impl Freeze for MessageBoxButtons
impl RefUnwindSafe for MessageBoxButtons
impl Send for MessageBoxButtons
impl Sync for MessageBoxButtons
impl Unpin for MessageBoxButtons
impl UnsafeUnpin for MessageBoxButtons
impl UnwindSafe for MessageBoxButtons
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.