xtd 1.0.0
Loading...
Searching...
No Matches
xtd::forms::message_box Class Referencefinal
Inheritance diagram for xtd::forms::message_box:
xtd::static_object

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.

Header
#include <xtd/forms/message_box>
Namespace
xtd::forms
Library
xtd.forms
Appearance
Windows macOS Gnome
Light
Dark
Examples
The following code example demonstrates the use of message_box dialog.
#include <xtd/xtd>
class form1 : public form {
public:
form1() {
controls().add_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 += delegate_ {
auto result = message_box::show(*this, "Hello, World!", "Message", message_box_buttons::ok_cancel, message_box_icon::warning);
label_dialog_result.text(string::format("dialog_result = {}", result));
};
label_dialog_result.location({10, 55});
label_dialog_result.width(200);
}
private:
button button_show_message;
label label_dialog_result;
};
auto main() -> int {
application::run(form1 {});
}
virtual auto text() const noexcept -> const xtd::string &
Gets the text associated with this control.
virtual auto location() const noexcept -> xtd::drawing::point
Gets the coordinates of the upper-left corner of the control relative to the upper-left corner of its...
virtual auto controls() noexcept -> control_collection &
Gets the collection of controls contained within the control.
Represents a window or dialog box that makes up an application's user interface.
Definition form.hpp:54
virtual auto start_position() const noexcept -> xtd::forms::form_start_position
Gets the starting position of the form at run time.
static auto show() -> xtd::forms::dialog_result
Displays a message box.
#define delegate_
The declaration of a delegate type is similar to a method signature. It has a return value and any nu...
Definition delegate.hpp:1018
xtd::forms::style_sheets::control label
The label data allows you to specify the box of a label control.
Definition label.hpp:25
xtd::forms::style_sheets::control button
The buttton data allows you to specify the box of a button control.
Definition button.hpp:25

Public Static Methods

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

Member Function Documentation

◆ show() [1/16]

auto xtd::forms::message_box::show ( const xtd::forms::iwin32_window & owner) -> xtd::forms::dialog_result
static

Displays a message box in front of the specified window.

Parameters
ownerAn implementation of xtd::forms::iwin32_window that will own the modal dialog box.
Returns
One of the xtd::forms::dialog_result values.
Examples
form2.cpp.

◆ show() [2/16]

auto xtd::forms::message_box::show ( const xtd::forms::iwin32_window & owner,
const xtd::string & text ) -> xtd::forms::dialog_result
static

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

Parameters
ownerAn implementation of xtd::forms::iwin32_window that will own the modal dialog box.
textThe text to display in the message box.
Returns
One of the xtd::forms::dialog_result values.

◆ show() [3/16]

auto xtd::forms::message_box::show ( const xtd::forms::iwin32_window & owner,
const xtd::string & text,
const xtd::string & caption ) -> xtd::forms::dialog_result
static

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

Parameters
ownerAn implementation of xtd::forms::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.
Returns
One of the xtd::forms::dialog_result values.

◆ show() [4/16]

auto xtd::forms::message_box::show ( const xtd::forms::iwin32_window & owner,
const xtd::string & text,
const xtd::string & caption,
xtd::forms::message_box_buttons buttons ) -> xtd::forms::dialog_result
static

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

Parameters
ownerAn implementation of xtd::forms::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 xtd::forms::message_box_buttons values that specifies which buttons to display in the message box.
Returns
One of the xtd::forms::dialog_result values.

◆ show() [5/16]

auto xtd::forms::message_box::show ( const xtd::forms::iwin32_window & owner,
const xtd::string & text,
const xtd::string & caption,
xtd::forms::message_box_buttons buttons,
xtd::forms::message_box_icon icon ) -> xtd::forms::dialog_result
static

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

Parameters
ownerAn implementation of xtd::forms::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 xtd::forms::message_box_buttons values that specifies which buttons to display in the message box.
iconOne of the xtd::forms::message_box_icon values that specifies which icon to display in the message box.
Returns
One of the xtd::forms::dialog_result values.

◆ show() [6/16]

auto xtd::forms::message_box::show ( const xtd::forms::iwin32_window & owner,
const xtd::string & text,
const xtd::string & caption,
xtd::forms::message_box_buttons buttons,
xtd::forms::message_box_icon icon,
xtd::forms::message_box_default_button default_button ) -> xtd::forms::dialog_result
static

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

Parameters
ownerAn implementation of xtd::forms::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 xtd::forms::message_box_buttons values that specifies which buttons to display in the message box.
iconOne of the xtd::forms::message_box_icon values that specifies which icon to display in the message box.
default_buttonOne of the xtd::forms::message_box_default_button values that specifies the default button for the message box.
Returns
One of the xtd::forms::dialog_result values.

◆ show() [7/16]

auto xtd::forms::message_box::show ( const xtd::forms::iwin32_window & owner,
const xtd::string & text,
const xtd::string & caption,
xtd::forms::message_box_buttons buttons,
xtd::forms::message_box_icon icon,
xtd::forms::message_box_default_button default_button,
xtd::forms::message_box_options options ) -> xtd::forms::dialog_result
static

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 xtd::forms::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 xtd::forms::message_box_buttons values that specifies which buttons to display in the message box.
iconOne of the xtd::forms::message_box_icon values that specifies which icon to display in the message box.
default_buttonOne of the xtd::forms::message_box_default_button values that specifies the default button for the message box.
optionsOne of the xtd::forms::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.
Returns
One of the xtd::forms::dialog_result values.

◆ show() [8/16]

auto xtd::forms::message_box::show ( const xtd::forms::iwin32_window & owner,
const xtd::string & text,
const xtd::string & caption,
xtd::forms::message_box_buttons buttons,
xtd::forms::message_box_icon icon,
xtd::forms::message_box_default_button default_button,
xtd::forms::message_box_options options,
bool display_help_button ) -> xtd::forms::dialog_result
static

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 xtd::forms::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 xtd::forms::message_box_buttons values that specifies which buttons to display in the message box.
iconOne of the xtd::forms::message_box_icon values that specifies which icon to display in the message box.
default_buttonOne of the xtd::forms::message_box_default_button values that specifies the default button for the message box.
optionsOne of the xtd::forms::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.
Returns
One of the xtd::forms::dialog_result values.

◆ show() [9/16]

auto xtd::forms::message_box::show ( ) -> xtd::forms::dialog_result
static

Displays a message box.

Returns
One of the xtd::forms::dialog_result values.

◆ show() [10/16]

auto xtd::forms::message_box::show ( const xtd::string & text) -> xtd::forms::dialog_result
static

Displays a message box with specified text.

Parameters
textThe text to display in the message box.
Returns
One of the xtd::forms::dialog_result values.

◆ show() [11/16]

auto xtd::forms::message_box::show ( const xtd::string & text,
const xtd::string & caption ) -> xtd::forms::dialog_result
static

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.
Returns
One of the xtd::forms::dialog_result values.

◆ show() [12/16]

auto xtd::forms::message_box::show ( const xtd::string & text,
const xtd::string & caption,
xtd::forms::message_box_buttons buttons ) -> xtd::forms::dialog_result
static

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 xtd::forms::message_box_buttons values that specifies which buttons to display in the message box.
Returns
One of the xtd::forms::dialog_result values.

◆ show() [13/16]

auto xtd::forms::message_box::show ( const xtd::string & text,
const xtd::string & caption,
xtd::forms::message_box_buttons buttons,
xtd::forms::message_box_icon icon ) -> xtd::forms::dialog_result
static

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 xtd::forms::message_box_buttons values that specifies which buttons to display in the message box.
iconOne of the xtd::forms::message_box_icon values that specifies which icon to display in the message box.
Returns
One of the xtd::forms::dialog_result values.

◆ show() [14/16]

auto xtd::forms::message_box::show ( const xtd::string & text,
const xtd::string & caption,
xtd::forms::message_box_buttons buttons,
xtd::forms::message_box_icon icon,
xtd::forms::message_box_default_button default_button ) -> xtd::forms::dialog_result
static

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 xtd::forms::message_box_buttons values that specifies which buttons to display in the message box.
iconOne of the xtd::forms::message_box_icon values that specifies which icon to display in the message box.
default_buttonOne of the xtd::forms::message_box_default_button values that specifies the default button for the message box.
Returns
One of the xtd::forms::dialog_result values.

◆ show() [15/16]

auto xtd::forms::message_box::show ( const xtd::string & text,
const xtd::string & caption,
xtd::forms::message_box_buttons buttons,
xtd::forms::message_box_icon icon,
xtd::forms::message_box_default_button default_button,
xtd::forms::message_box_options options ) -> xtd::forms::dialog_result
static

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 xtd::forms::message_box_buttons values that specifies which buttons to display in the message box.
iconOne of the xtd::forms::message_box_icon values that specifies which icon to display in the message box.
default_buttonOne of the xtd::forms::message_box_default_button values that specifies the default button for the message box.
optionsOne of the xtd::forms::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.
Returns
One of the xtd::forms::dialog_result values.

◆ show() [16/16]

auto xtd::forms::message_box::show ( const xtd::string & text,
const xtd::string & caption,
xtd::forms::message_box_buttons buttons,
xtd::forms::message_box_icon icon,
xtd::forms::message_box_default_button default_button,
xtd::forms::message_box_options options,
bool display_help_button ) -> xtd::forms::dialog_result
static

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 xtd::forms::message_box_buttons values that specifies which buttons to display in the message box.
iconOne of the xtd::forms::message_box_icon values that specifies which icon to display in the message box.
default_buttonOne of the xtd::forms::message_box_default_button values that specifies the default button for the message box.
optionsOne of the xtd::forms::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.
Returns
One of the xtd::forms::dialog_result values.

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