xtd 1.0.0
Loading...
Searching...
No Matches
xtd::forms::message_dialog Class Referencefinal
Inheritance diagram for xtd::forms::message_dialog:
xtd::forms::component xtd::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_dialog can contain text, buttons, and symbols that inform and instruct the user.

Header
#include <xtd/forms/message_dialog>
Namespace
xtd::forms
Library
xtd.forms
Appearance
Windows macOS Gnome
Light
Dark
Examples
The following code example demonstrates the use of message_dialog 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 dialog exemple");
button_show_message.location({10, 10});
button_show_message.text("Message...");
button_show_message.width(100);
button_show_message.click += delegate_ {
auto dialog = message_dialog {};
dialog.buttons(message_dialog_buttons::ok_cancel);
dialog.icon(message_dialog_icon::warning);
dialog.message("Hello, World!");
dialog.text("Message");
label_dialog_result.text(string::format("dialog_result = {}", dialog.show_sheet_dialog(*this)));
};
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.
#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 Events

xtd::event< message_dialog, xtd::forms::help_event_handlerhelp_request
 Occurs when the user clicks the Help button on a common dialog box.
xtd::event< message_dialog, xtd::forms::dialog_closed_event_handlerdialog_closed
 Occurs when the user close a message dialog box with dialog close button or other dialog buttons.

Public Constructors

 message_dialog ()
 Initializes a new instance of the message_dialog class.

Public Properties

auto buttons () const noexcept -> xtd::forms::message_dialog_buttons
 Gets buttons to display in the message dialog.
auto buttons (xtd::forms::message_dialog_buttons value) -> message_dialog &
 Sets buttons to display in the message dialog.
auto default_button () const noexcept -> xtd::forms::message_dialog_default_button
 Gets default button for the message dialog.
auto default_button (xtd::forms::message_dialog_default_button value) -> message_dialog &
 Sets default button for the message dialog.
auto display_help_button () const noexcept -> bool
 Gets a value indicate if help button is shown.
auto display_help_button (bool value) -> message_dialog &
 Sets a value indicate if help button is shown.
auto dialog_result () const noexcept -> xtd::forms::dialog_result
 Gets async dialog_result result after dialog box is closing.
auto dialog_appearance () const noexcept -> xtd::forms::dialog_appearance
 Gets the dialog appearance.
auto dialog_appearance (xtd::forms::dialog_appearance value) -> message_dialog &
 Sets the dialog appearance.
auto icon () const noexcept -> xtd::forms::message_dialog_icon
 Gets icon to display in the message dialog.
auto icon (xtd::forms::message_dialog_icon value) -> message_dialog &
 Sets icon to display in the message dialog.
auto options () const noexcept -> xtd::forms::message_dialog_options
 Gets options will be used for the message box.
auto options (xtd::forms::message_dialog_options value) -> message_dialog &
 Sets options will be used for the message box.
auto message () const noexcept -> xtd::string
 Gets the text message.
auto message (const xtd::string &value) -> message_dialog &
 Sets the text message.
auto text () const noexcept -> xtd::string
 Gets the dialog caption text.
auto text (const xtd::string &value) -> message_dialog &
 Sets the dialog caption text.

Public Methods

void reset ()
 Resets all properties to empty string.
auto show_dialog () -> xtd::forms::dialog_result
 Runs message dialog box.
auto show_dialog (const xtd::forms::iwin32_window &owner) -> xtd::forms::dialog_result
 Runs message dialog box.
auto show_sheet (const iwin32_window &owner) -> void
 Runs message dialog box.
auto show_sheet_dialog (const xtd::forms::iwin32_window &owner) -> xtd::forms::dialog_result
 Runs message dialog box.

Additional Inherited Members

 object ()=default
 Create a new instance of the ultimate base class object.
virtual auto equals (const object &obj) const noexcept -> bool
 Determines whether the specified object is equal to the current object.
virtual auto get_hash_code () const noexcept -> xtd::usize
 Serves as a hash function for a particular type.
virtual auto get_type () const noexcept -> type_object
 Gets the type of the current instance.
template<typename object_t>
auto memberwise_clone () const -> xtd::unique_ptr_object< object_t >
 Creates a shallow copy of the current object.
virtual auto to_string () const -> xtd::string
 Returns a xtd::string that represents the current object.
template<typename object_a_t, typename object_b_t>
static auto equals (const object_a_t &object_a, const object_b_t &object_b) noexcept -> bool
 Determines whether the specified object instances are considered equal.
template<typename object_a_t, typename object_b_t>
static auto reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept -> bool
 Determines whether the specified object instances are the same instance.
 component ()
 Initialises a new instance of the component class.
virtual auto can_raise_events () const noexcept -> bool
 Gets a value indicating whether the component can raise an event.
auto design_mode () const noexcept -> bool
 Gets a value that indicates whether the component is currently in design mode.

Constructor & Destructor Documentation

◆ message_dialog()

xtd::forms::message_dialog::message_dialog ( )

Initializes a new instance of the message_dialog class.

Member Function Documentation

◆ buttons() [1/2]

auto xtd::forms::message_dialog::buttons ( ) const -> xtd::forms::message_dialog_buttons
nodiscardnoexcept

Gets buttons to display in the message dialog.

Returns
One of the xtd::forms::message_dialog_buttons values that specifies which buttons to display in the message dialog.

◆ buttons() [2/2]

auto xtd::forms::message_dialog::buttons ( xtd::forms::message_dialog_buttons value) -> message_dialog &

Sets buttons to display in the message dialog.

Parameters
valueOne of the xtd::forms::message_dialog_buttons values that specifies which buttons to display in the message dialog.
Returns
Current message dialog.

◆ default_button() [1/2]

auto xtd::forms::message_dialog::default_button ( ) const -> xtd::forms::message_dialog_default_button
nodiscardnoexcept

Gets default button for the message dialog.

Returns
One of the xtd::forms::message_dialog_default_button values that specifies the default button for the message dialog.

◆ default_button() [2/2]

auto xtd::forms::message_dialog::default_button ( xtd::forms::message_dialog_default_button value) -> message_dialog &

Sets default button for the message dialog.

Parameters
valueOne of the xtd::forms::message_dialog_default_button values that specifies the default button for the message dialog.
Returns
Current message dialog.

◆ display_help_button() [1/2]

auto xtd::forms::message_dialog::display_help_button ( ) const -> bool
nodiscardnoexcept

Gets a value indicate if help button is shown.

Returns
true to show the Help button; otherwise, false. The default is false.

◆ display_help_button() [2/2]

auto xtd::forms::message_dialog::display_help_button ( bool value) -> message_dialog &

Sets a value indicate if help button is shown.

Parameters
valuetrue to show the Help button; otherwise, false. The default is false.
Returns
Current message dialog.

◆ dialog_result()

auto xtd::forms::message_dialog::dialog_result ( ) const -> xtd::forms::dialog_result
nodiscardnoexcept

Gets async dialog_result result after dialog box is closing.

Returns
ok if the user clicks OK in the dialog box; otherwise, cancel.

◆ dialog_appearance() [1/2]

auto xtd::forms::message_dialog::dialog_appearance ( ) const -> xtd::forms::dialog_appearance
nodiscardnoexcept

Gets the dialog appearance.

Returns
One of the xtd::forms::dialog_appearance values. The default value is xtd::forms::dialog_appearance::standard.

◆ dialog_appearance() [2/2]

auto xtd::forms::message_dialog::dialog_appearance ( xtd::forms::dialog_appearance value) -> message_dialog &

Sets the dialog appearance.

Parameters
valueOne of the xtd::forms::dialog_appearance values. The default value is xtd::forms::dialog_appearance::standard.
Returns
Current message dialog.

◆ icon() [1/2]

auto xtd::forms::message_dialog::icon ( ) const -> xtd::forms::message_dialog_icon
nodiscardnoexcept

Gets icon to display in the message dialog.

Returns
One of the xtd::forms::message_dialog_icon values that specifies which icon to display in the message dialog.

◆ icon() [2/2]

auto xtd::forms::message_dialog::icon ( xtd::forms::message_dialog_icon value) -> message_dialog &

Sets icon to display in the message dialog.

Parameters
valueOne of the xtd::forms::message_dialog_icon values that specifies which icon to display in the message dialog.
Returns
Current message dialog.

◆ options() [1/2]

auto xtd::forms::message_dialog::options ( ) const -> xtd::forms::message_dialog_options
nodiscardnoexcept

Gets options will be used for the message box.

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

◆ options() [2/2]

auto xtd::forms::message_dialog::options ( xtd::forms::message_dialog_options value) -> message_dialog &

Sets options will be used for the message box.

Parameters
valueOne of the xtd::forms::message_dialog_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
Current message dialog.

◆ message() [1/2]

auto xtd::forms::message_dialog::message ( ) const -> xtd::string
nodiscardnoexcept

Gets the text message.

Returns
The text message.

◆ message() [2/2]

auto xtd::forms::message_dialog::message ( const xtd::string & value) -> message_dialog &

Sets the text message.

Parameters
valueThe text message.
Returns
Current message_dialog instance.

◆ text() [1/2]

auto xtd::forms::message_dialog::text ( ) const -> xtd::string
nodiscardnoexcept

Gets the dialog caption text.

Returns
The current dialog caption text.

◆ text() [2/2]

auto xtd::forms::message_dialog::text ( const xtd::string & value) -> message_dialog &

Sets the dialog caption text.

Parameters
valueThe new dialog caption text.
Returns
Current message_dialog instance.

◆ reset()

void xtd::forms::message_dialog::reset ( )

Resets all properties to empty string.

◆ show_dialog() [1/2]

auto xtd::forms::message_dialog::show_dialog ( ) -> xtd::forms::dialog_result

Runs message dialog box.

◆ show_dialog() [2/2]

auto xtd::forms::message_dialog::show_dialog ( const xtd::forms::iwin32_window & owner) -> xtd::forms::dialog_result

Runs message dialog box.

◆ show_sheet()

auto xtd::forms::message_dialog::show_sheet ( const iwin32_window & owner) -> void

Runs message dialog box.

◆ show_sheet_dialog()

auto xtd::forms::message_dialog::show_sheet_dialog ( const xtd::forms::iwin32_window & owner) -> xtd::forms::dialog_result

Runs message dialog box.

Member Data Documentation

◆ help_request

xtd::event<message_dialog, xtd::forms::help_event_handler> xtd::forms::message_dialog::help_request

Occurs when the user clicks the Help button on a common dialog box.

Remarks
For more information about handling events, see Handling and Raising Events.

◆ dialog_closed

xtd::event<message_dialog, xtd::forms::dialog_closed_event_handler> xtd::forms::message_dialog::dialog_closed

Occurs when the user close a message dialog box with dialog close button or other dialog buttons.

Remarks
For more information about handling events, see Handling and Raising Events.

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