pub struct WinDialog<T = OkCancel, const DEFAULT_BUTTON: i32 = 0>where
T: DialogStyle,{ /* private fields */ }
Expand description
A builder struct used for configuring a MessageBox. Uses the MessageBoxA function under the hood.
From the official Windows documentation:
“Displays a modal dialog box that contains a system icon, a set of buttons, and a brief application-specific message, such as status or error information. The message box returns an integer value that indicates which button the user clicked.”
The default button const generic
Implementations§
Source§impl<T> WinDialog<T>where
T: Default + DialogStyle,
impl<T> WinDialog<T>where
T: Default + DialogStyle,
Sourcepub fn with_header(self, header: impl Into<String>) -> Self
pub fn with_header(self, header: impl Into<String>) -> Self
Sets custom content for the message box header. Passing nothing results in rendering a default header. Passing an empty string results in no header.
Sourcepub fn set_parent_window(
self,
handle: impl Into<HWND>,
) -> WinDialogWithParent<T>
pub fn set_parent_window( self, handle: impl Into<HWND>, ) -> WinDialogWithParent<T>
A handle to the owner window of the message box to be created. If you don’t call this method and provide a handle to the owner window, the Message Box will have no parent window.
Attaching a parent window will allow you to add an extra ‘help’ button to the message box. See WinDialogWithParent::with_help_button for more information.
Sourcepub fn set_modality(self, modality: Modality) -> Self
pub fn set_modality(self, modality: Modality) -> Self
Indicate the modality of the dialog box. See Modality for the options.
Sourcepub fn set_default_desktop_only(self) -> Self
pub fn set_default_desktop_only(self) -> Self
Same as desktop of the interactive window station. For more information, see Window Stations. If the current input desktop is not the default desktop, the Message Box does not return until the user switches to the default desktop.
Sourcepub fn set_right_justify(self) -> Self
pub fn set_right_justify(self) -> Self
Set the text to right-justify style.
Sourcepub fn set_right_to_left_reading(self) -> Self
pub fn set_right_to_left_reading(self) -> Self
Displays message and caption text using right-to-left reading order on Hebrew and Arabic systems.
Sourcepub fn set_foreground(self) -> Self
pub fn set_foreground(self) -> Self
The message box becomes the foreground window. Internally, the system calls the SetForegroundWindow function for the message box.
Sourcepub fn set_topmost(self) -> Self
pub fn set_topmost(self) -> Self
The message box is created with the WS_EX_TOPMOST window style.
Sourcepub fn make_service_notification(self) -> Self
pub fn make_service_notification(self) -> Self
The caller is a service notifying the user of an event. The function displays a message box on the current active desktop, even if there is no user logged on to the computer. Terminal Services: If the calling thread has an impersonation token, the function directs the message box to the session specified in the impersonation token.
If this function is set, the window must not have a parent. This is so that the message box can appear on a desktop other than the desktop corresponding to the parent window. For this reason, if you call WinDialog::set_parent_window, this parameter will be unset.
For information on security considerations in regard to using this flag, see Interactive Services. In particular, be aware that this flag can produce interactive content on a locked desktop and should therefore be used for only a very limited set of scenarios, such as resource exhaustion.
Sourcepub fn with_style<N>(self, style: N) -> WinDialog<N>where
N: DialogStyle,
pub fn with_style<N>(self, style: N) -> WinDialog<N>where
N: DialogStyle,
Indicate which set of actions that you want the user to have. Check the available options in crate::style.
Source§impl WinDialog<OkCancel>
impl WinDialog<OkCancel>
Sourcepub fn set_default_cancel(self) -> Self
pub fn set_default_cancel(self) -> Self
Make crate::style::OkCancelResponse::Cancel the default response,
Source§impl WinDialog<AbortRetryIgnore>
impl WinDialog<AbortRetryIgnore>
Sourcepub fn set_default_retry(self) -> Self
pub fn set_default_retry(self) -> Self
Make crate::style::AbortRetryIgnoreResponse::Retry the default response,
Sourcepub fn set_default_ignore(self) -> Self
pub fn set_default_ignore(self) -> Self
Make crate::style::AbortRetryIgnoreResponse::Ignore the default response,
Source§impl WinDialog<YesNoCancel>
impl WinDialog<YesNoCancel>
Sourcepub fn set_default_no(self) -> Self
pub fn set_default_no(self) -> Self
Make crate::style::YesNoCancelResponse::No the default response,
Sourcepub fn set_default_cancel(self) -> Self
pub fn set_default_cancel(self) -> Self
Make crate::style::YesNoCancelResponse::Cancel the default response.
Source§impl WinDialog<YesNo>
impl WinDialog<YesNo>
Sourcepub fn set_default_no(self) -> Self
pub fn set_default_no(self) -> Self
Make crate::style::YesNoResponse::No the default response.
Source§impl WinDialog<RetryCancel>
impl WinDialog<RetryCancel>
Sourcepub fn set_default_cancel(self) -> Self
pub fn set_default_cancel(self) -> Self
Make crate::style::RetryCancelResponse::Cancel the default response.
Source§impl WinDialog<CancelRetryContinue>
impl WinDialog<CancelRetryContinue>
Sourcepub fn set_default_retry(self) -> Self
pub fn set_default_retry(self) -> Self
Make crate::style::CancelRetryContinueResponse::Retry the default response.
Sourcepub fn set_default_continue(self) -> Self
pub fn set_default_continue(self) -> Self
Make crate::style::CancelRetryContinueResponse::Continue the default response.