xtd 0.2.0
Loading...
Searching...
No Matches

◆ dialog_result

enum class xtd::forms::dialog_result
strong

Specifies identifiers to indicate the return value of a dialog box.

Header
#include <xtd/forms/dialog_result>
Namespace
xtd::forms
Library
xtd.forms
Remarks
The xtd::forms::button::dialog_result property and the xtd::forms::form::show_dialog method use this enumeration.
Examples
The following code example demonstrates how to display a xtd::forms::message_box with the options supported by this overload of xtd::forms::message_box::show. After verifying that a string variable, ServerName, is empty, the example displays a MessageBox, offering the user the option to cancel the operation. If the Show method's return value evaluates to Yes, the form that displayed the MessageBox is closed.
void validate_user_entry() {
// Checks the value of the text.
if (server_name.text().size() == 0) {
// Initializes the variables to pass to the xtd::forms::message_box::show method.
string message = "You did not enter a server name. Cancel this operation?";
string caption = "No Server Name Specified";
dialog_result result;
// Displays the xtd::forms::message_box.
result = message_box::show(*this, message, caption, buttons);
if (result == dialog_result::yes) {
// Closes the parent form.
close();
}
}
}
Provides a collection of button objects for use by a Windows Forms application.
Definition buttons.h:24
static dialog_result show()
Displays a message box.
Implements a Windows message.
Definition message.h:28
dialog_result
Specifies identifiers to indicate the return value of a dialog box.
Definition dialog_result.h:43
@ yes
The dialog box return value is Yes (usually sent from a button labeled Yes).
message_dialog_buttons
Specifies constants defining which buttons to display on a message_box.
Definition message_dialog_buttons.h:22
@ yes_no
The message box contains Yes and No buttons.
Enumerator
none 

Nothing is returned from the dialog box. This means that the modal dialog continues running.

ok 

The dialog box return value is OK (usually sent from a button labeled OK).

cancel 

The dialog box return value is Cancel (usually sent from a button labeled Cancel).

abort 

The dialog box return value is Abort (usually sent from a button labeled Abort).

retry 

The dialog box return value is Retry (usually sent from a button labeled Retry).

ignore 

The dialog box return value is Ignore (usually sent from a button labeled Ignore).

yes 

The dialog box return value is Yes (usually sent from a button labeled Yes).

no 

The dialog box return value is No (usually sent from a button labeled No).