xtd - Reference Guide  0.1.1
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Static Public Member Functions | List of all members
xtd::forms::message_box Class Referencefinal

#include <message_box.h>

Definition

Displays a message window, also known as a dialog box, which presents a message to the user. It is a modal window, blocking other actions in the application until the user closes it. A message_box can contain text, buttons, and symbols that inform and instruct the user.

Namespace
xtd::forms
Library
xtd.forms
Examples
The following code example demonstrate the use of message_box dialog.
#include <xtd/xtd>
using namespace xtd;
using namespace xtd::forms;
class form1 : public form {
public:
form1() {
controls().push_back_range({button_show_message, label_dialog_result});
location({400, 200});
start_position(form_start_position::manual);
text("Message box exemple");
button_show_message.location({10, 10});
button_show_message.text("Message...");
button_show_message.width(100);
button_show_message.click += [&] {
forms::dialog_result result = message_box::show(*this, "Hello, World!", "Message", message_box_buttons::ok_cancel, message_box_icon::warning);
label_dialog_result.text(ustring::format("dialog_result = {}", result));
};
label_dialog_result.location({10, 45});
label_dialog_result.width(200);
}
private:
button button_show_message;
label label_dialog_result;
};
int main() {
application::run(form1());
}
static void run()
Begins running a standard application message loop on the current thread, without a form.
static dialog_result show()
Displays a message box.
Definition: message_box.h:86
static ustring format(const ustring &fmt, args_t &&... args)
Writes the text representation of the specified arguments list, to string using the specified format ...
Definition: ustring.h:689
dialog_result
Specifies identifiers to indicate the return value of a dialog box.
Definition: dialog_result.h:39
@ location
Specifies that both the x and y coordinates of the control are defined.
@ manual
The position of the form is determined by the Location property.
@ button
The appearance of a button.
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition: about_box.h:13
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition: system_report.h:17

Inherits xtd::static_object.

Static Public Member Functions

static dialog_result show ()
 Displays a message box. More...
 
static dialog_result show (const iwin32_window &owner)
 Displays a message box in front of the specified window. More...
 
static dialog_result show (const iwin32_window &owner, const xtd::ustring &text)
 Displays a message box in front of the specified window with specified text. More...
 
static dialog_result show (const iwin32_window &owner, const xtd::ustring &text, const xtd::ustring &caption)
 Displays a message box in front of the specified window with specified text and caption. More...
 
static dialog_result show (const iwin32_window &owner, const xtd::ustring &text, const xtd::ustring &caption, message_box_buttons buttons)
 Displays a message box in front of the specified window with the specified text, caption, and buttons. More...
 
static dialog_result show (const iwin32_window &owner, const xtd::ustring &text, const xtd::ustring &caption, message_box_buttons buttons, message_box_icon icon)
 Displays a message box in front of the specified window with the specified text, caption, buttons, and icon. More...
 
static dialog_result show (const iwin32_window &owner, const xtd::ustring &text, const xtd::ustring &caption, message_box_buttons buttons, message_box_icon icon, message_box_default_button default_button)
 Displays a message box in front of the specified window with the specified text, caption, buttons, icon, and default button. More...
 
static dialog_result show (const iwin32_window &owner, const xtd::ustring &text, const xtd::ustring &caption, message_box_buttons buttons, message_box_icon icon, message_box_default_button default_button, message_box_options options)
 Displays a message box in front of the specified window with the specified text, caption, buttons, icon, default button, and options. More...
 
static dialog_result show (const iwin32_window &owner, const xtd::ustring &text, const xtd::ustring &caption, message_box_buttons buttons, message_box_icon icon, message_box_default_button default_button, message_box_options options, bool display_help_button)
 Displays a message box in front of the specified window with the specified text, caption, buttons, icon, default button, options, and Help button. More...
 
static dialog_result show (const xtd::ustring &text)
 Displays a message box with specified text. More...
 
static dialog_result show (const xtd::ustring &text, const xtd::ustring &caption)
 Displays a message box with specified text and caption. More...
 
static dialog_result show (const xtd::ustring &text, const xtd::ustring &caption, message_box_buttons buttons)
 Displays a message box with the specified text, caption, and buttons. More...
 
static dialog_result show (const xtd::ustring &text, const xtd::ustring &caption, message_box_buttons buttons, message_box_icon icon)
 Displays a message box with the specified text, caption, buttons, and icon. More...
 
static dialog_result show (const xtd::ustring &text, const xtd::ustring &caption, message_box_buttons buttons, message_box_icon icon, message_box_default_button default_button)
 Displays a message box with the specified text, caption, buttons, icon, and default button. More...
 
static dialog_result show (const xtd::ustring &text, const xtd::ustring &caption, message_box_buttons buttons, message_box_icon icon, message_box_default_button default_button, message_box_options options)
 Displays a message box with the specified text, caption, buttons, icon, default button, and options. More...
 
static dialog_result show (const xtd::ustring &text, const xtd::ustring &caption, message_box_buttons buttons, message_box_icon icon, message_box_default_button default_button, message_box_options options, bool display_help_button)
 Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button. More...
 

Member Function Documentation

◆ show() [1/16]

static dialog_result xtd::forms::message_box::show ( )
inlinestatic

Displays a message box.

Examples
message_box.cpp.

◆ show() [2/16]

static dialog_result xtd::forms::message_box::show ( const iwin32_window owner)
inlinestatic

Displays a message box in front of the specified window.

Parameters
ownerAn implementation of iwin32_window that will own the modal dialog box.

◆ show() [3/16]

static dialog_result xtd::forms::message_box::show ( const iwin32_window owner,
const xtd::ustring text 
)
inlinestatic

Displays a message box in front of the specified window with specified text.

Parameters
ownerAn implementation of iwin32_window that will own the modal dialog box.
textThe text to display in the message box.

◆ show() [4/16]

static dialog_result xtd::forms::message_box::show ( const iwin32_window owner,
const xtd::ustring text,
const xtd::ustring caption 
)
inlinestatic

Displays a message box in front of the specified window with specified text and caption.

Parameters
ownerAn implementation of iwin32_window that will own the modal dialog box.
textThe text to display in the message box.
captionThe text to display in the title bar of the message box.

◆ show() [5/16]

static dialog_result xtd::forms::message_box::show ( const iwin32_window owner,
const xtd::ustring text,
const xtd::ustring caption,
message_box_buttons  buttons 
)
inlinestatic

Displays a message box in front of the specified window with the specified text, caption, and buttons.

Parameters
ownerAn implementation of iwin32_window that will own the modal dialog box.
textThe text to display in the message box.
captionThe text to display in the title bar of the message box.
buttonsOne of the message_box_buttons values that specifies which buttons to display in the message box.

◆ show() [6/16]

static dialog_result xtd::forms::message_box::show ( const iwin32_window owner,
const xtd::ustring text,
const xtd::ustring caption,
message_box_buttons  buttons,
message_box_icon  icon 
)
inlinestatic

Displays a message box in front of the specified window with the specified text, caption, buttons, and icon.

Parameters
ownerAn implementation of iwin32_window that will own the modal dialog box.
textThe text to display in the message box.
captionThe text to display in the title bar of the message box.
buttonsOne of the message_box_buttons values that specifies which buttons to display in the message box.
iconOne of the message_box_icon values that specifies which icon to display in the message box.

◆ show() [7/16]

static dialog_result xtd::forms::message_box::show ( const iwin32_window owner,
const xtd::ustring text,
const xtd::ustring caption,
message_box_buttons  buttons,
message_box_icon  icon,
message_box_default_button  default_button 
)
inlinestatic

Displays a message box in front of the specified window with the specified text, caption, buttons, icon, and default button.

Parameters
ownerAn implementation of iwin32_window that will own the modal dialog box.
textThe text to display in the message box.
captionThe text to display in the title bar of the message box.
buttonsOne of the message_box_buttons values that specifies which buttons to display in the message box.
iconOne of the message_box_icon values that specifies which icon to display in the message box.
default_buttonOne of the message_box_default_button values that specifies the default button for the message box.

◆ show() [8/16]

static dialog_result xtd::forms::message_box::show ( const iwin32_window owner,
const xtd::ustring text,
const xtd::ustring caption,
message_box_buttons  buttons,
message_box_icon  icon,
message_box_default_button  default_button,
message_box_options  options 
)
inlinestatic

Displays a message box in front of the specified window with the specified text, caption, buttons, icon, default button, and options.

Parameters
ownerAn implementation of iwin32_window that will own the modal dialog box.
textThe text to display in the message box.
captionThe text to display in the title bar of the message box.
buttonsOne of the message_box_buttons values that specifies which buttons to display in the message box.
iconOne of the message_box_icon values that specifies which icon to display in the message box.
default_buttonOne of the message_box_default_button values that specifies the default button for the message box.
optionsOne of the message_box_options values that specifies which display and association options will be used for the message box. You may pass in 0 if you wish to use the defaults.

◆ show() [9/16]

static dialog_result xtd::forms::message_box::show ( const iwin32_window owner,
const xtd::ustring text,
const xtd::ustring caption,
message_box_buttons  buttons,
message_box_icon  icon,
message_box_default_button  default_button,
message_box_options  options,
bool  display_help_button 
)
inlinestatic

Displays a message box in front of the specified window with the specified text, caption, buttons, icon, default button, options, and Help button.

Parameters
ownerAn implementation of iwin32_window that will own the modal dialog box.
textThe text to display in the message box.
captionThe text to display in the title bar of the message box.
buttonsOne of the message_box_buttons values that specifies which buttons to display in the message box.
iconOne of the message_box_icon values that specifies which icon to display in the message box.
default_buttonOne of the message_box_default_button values that specifies the default button for the message box.
optionsOne of the message_box_options values that specifies which display and association options will be used for the message box. You may pass in 0 if you wish to use the defaults.
display_help_buttontrue to show the Help button; otherwise, false. The default is false.

◆ show() [10/16]

static dialog_result xtd::forms::message_box::show ( const xtd::ustring text)
inlinestatic

Displays a message box with specified text.

Parameters
textThe text to display in the message box.

◆ show() [11/16]

static dialog_result xtd::forms::message_box::show ( const xtd::ustring text,
const xtd::ustring caption 
)
inlinestatic

Displays a message box with specified text and caption.

Parameters
textThe text to display in the message box.
captionThe text to display in the title bar of the message box.

◆ show() [12/16]

static dialog_result xtd::forms::message_box::show ( const xtd::ustring text,
const xtd::ustring caption,
message_box_buttons  buttons 
)
inlinestatic

Displays a message box with the specified text, caption, and buttons.

Parameters
textThe text to display in the message box.
captionThe text to display in the title bar of the message box.
buttonsOne of the message_box_buttons values that specifies which buttons to display in the message box.

◆ show() [13/16]

static dialog_result xtd::forms::message_box::show ( const xtd::ustring text,
const xtd::ustring caption,
message_box_buttons  buttons,
message_box_icon  icon 
)
inlinestatic

Displays a message box with the specified text, caption, buttons, and icon.

Parameters
textThe text to display in the message box.
captionThe text to display in the title bar of the message box.
buttonsOne of the message_box_buttons values that specifies which buttons to display in the message box.
iconOne of the message_box_icon values that specifies which icon to display in the message box.

◆ show() [14/16]

static dialog_result xtd::forms::message_box::show ( const xtd::ustring text,
const xtd::ustring caption,
message_box_buttons  buttons,
message_box_icon  icon,
message_box_default_button  default_button 
)
inlinestatic

Displays a message box with the specified text, caption, buttons, icon, and default button.

Parameters
textThe text to display in the message box.
captionThe text to display in the title bar of the message box.
buttonsOne of the message_box_buttons values that specifies which buttons to display in the message box.
iconOne of the message_box_icon values that specifies which icon to display in the message box.
default_buttonOne of the message_box_default_button values that specifies the default button for the message box.

◆ show() [15/16]

static dialog_result xtd::forms::message_box::show ( const xtd::ustring text,
const xtd::ustring caption,
message_box_buttons  buttons,
message_box_icon  icon,
message_box_default_button  default_button,
message_box_options  options 
)
inlinestatic

Displays a message box with the specified text, caption, buttons, icon, default button, and options.

Parameters
textThe text to display in the message box.
captionThe text to display in the title bar of the message box.
buttonsOne of the message_box_buttons values that specifies which buttons to display in the message box.
iconOne of the message_box_icon values that specifies which icon to display in the message box.
default_buttonOne of the message_box_default_button values that specifies the default button for the message box.
optionsOne of the message_box_options values that specifies which display and association options will be used for the message box. You may pass in 0 if you wish to use the defaults.

◆ show() [16/16]

static dialog_result xtd::forms::message_box::show ( const xtd::ustring text,
const xtd::ustring caption,
message_box_buttons  buttons,
message_box_icon  icon,
message_box_default_button  default_button,
message_box_options  options,
bool  display_help_button 
)
inlinestatic

Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button.

Parameters
textThe text to display in the message box.
captionThe text to display in the title bar of the message box.
buttonsOne of the message_box_buttons values that specifies which buttons to display in the message box.
iconOne of the message_box_icon values that specifies which icon to display in the message box.
default_buttonOne of the message_box_default_button values that specifies the default button for the message box.
optionsOne of the message_box_options values that specifies which display and association options will be used for the message box. You may pass in 0 if you wish to use the defaults.
display_help_buttontrue to show the Help button; otherwise, false. The default is false.

The documentation for this class was generated from the following file: