xtd - Reference Guide  0.1.2
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Loading...
Searching...
No Matches
Public Attributes | Public Member Functions | List of all members
xtd::forms::message_dialog Class Referencefinal

#include <message_dialog.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_dialog 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_dialog 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 dialog exemple");
button_show_message.location({10, 10});
button_show_message.text("Message...");
button_show_message.width(100);
button_show_message.click += [&] {
dialog.buttons(message_dialog_buttons::ok_cancel);
dialog.icon(message_dialog_icon::warning);
dialog.message("Hello, World!");
dialog.text("Message");
label_dialog_result.text(ustring::format("dialog_result = {}", dialog.show_sheet_dialog(*this)));
};
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.
Represents a Windows button control.
Definition button.h:54
Represents a window or dialog box that makes up an application's user interface.
Definition form.h:40
Represents a standard Windows label.
Definition label.h:26
Displays a message window, also known as a dialog box, which presents a message to the user....
Definition message_dialog.h:34
xtd::forms::message_dialog_buttons buttons() const
Gets buttons to display in the message dialog.
Definition message_dialog.h:41
xtd::forms::message_dialog_icon icon() const
Gets icon to display in the message dialog.
Definition message_dialog.h:93
xtd::ustring text() const
Gets the dialog caption text.
Definition message_dialog.h:129
xtd::ustring message() const
Gets the text message.
Definition message_dialog.h:117
xtd::forms::dialog_result show_sheet_dialog(const iwin32_window &owner)
Runs message dialog box.
@ location
Specifies that both the x and y coordinates of the control are defined.
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
Examples
message_dialog.cpp.

Inherits xtd::forms::component.

Public Attributes

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

Public Member Functions

 message_dialog ()=default
 Initializes a new instance of the message_dialog class.
 
xtd::forms::message_dialog_buttons buttons () const
 Gets buttons to display in the message dialog.
 
message_dialogbuttons (xtd::forms::message_dialog_buttons buttons)
 Sets buttons to display in the message dialog.
 
xtd::forms::message_dialog_default_button default_button () const
 Gets default button for the message dialog.
 
message_dialogdefault_button (xtd::forms::message_dialog_default_button default_button)
 Sets default button for the message dialog.
 
xtd::forms::dialog_result dialog_result () const
 Get async dialog_result result after dialog box is closing.
 
xtd::forms::dialog_style dialog_style () const
 Gets the dialog style.
 
message_dialogdialog_style (xtd::forms::dialog_style dialog_style)
 Sets the dialog style.
 
bool display_help_button () const
 Gets a value indicate if help button is shown.
 
message_dialogdisplay_help_button (bool display_help_button)
 Sets a value indicate if help button is shown.
 
xtd::forms::message_dialog_icon icon () const
 Gets icon to display in the message dialog.
 
message_dialogicon (xtd::forms::message_dialog_icon icon)
 Sets icon to display in the message dialog.
 
xtd::ustring message () const
 Gets the text message.
 
message_dialogmessage (const xtd::ustring &message)
 Sets the text message.
 
xtd::forms::message_dialog_options options () const
 Gets options will be used for the message box.
 
message_dialogoptions (xtd::forms::message_dialog_options options)
 Sets options will be used for the message box.
 
void reset ()
 Resets all properties to empty string.
 
xtd::forms::dialog_result show_dialog ()
 Runs message dialog box.
 
xtd::forms::dialog_result show_dialog (const iwin32_window &owner)
 Runs message dialog box.
 
void show_sheet (const iwin32_window &owner)
 Runs message dialog box.
 
xtd::forms::dialog_result show_sheet_dialog (const iwin32_window &owner)
 Runs message dialog box.
 
xtd::ustring text () const
 Gets the dialog caption text.
 
message_dialogtext (const xtd::ustring &text)
 Sets the dialog caption text.
 
- Public Member Functions inherited from xtd::object
 object ()=default
 Create a new instance of the ultimate base class object.
 
virtual bool equals (const object &obj) const noexcept
 Determines whether the specified object is equal to the current object.
 
virtual size_t get_hash_code () const noexcept
 Serves as a hash function for a particular type.
 
template<typename object_t >
std::unique_ptr< object_t > memberwise_clone () const
 Gets the type of the current instance.
 
virtual xtd::ustring to_string () const noexcept
 Returns a std::string that represents the current object.
 

Additional Inherited Members

- Static Public Member Functions inherited from xtd::object
static bool equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are considered equal.
 
static bool reference_equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are the same instance.
 
- Protected Member Functions inherited from xtd::forms::component
 component ()=default
 Initialises a new instance of the component class.
 
virtual bool can_raise_events () const
 Gets a value indicating whether the component can raise an event.
 
bool design_mode () const
 Gets a value that indicates whether the component is currently in design mode.
 

Constructor & Destructor Documentation

◆ message_dialog()

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

Initializes a new instance of the message_dialog class.

Member Function Documentation

◆ buttons() [1/2]

xtd::forms::message_dialog_buttons xtd::forms::message_dialog::buttons ( ) const
inline

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.
Examples
message_dialog.cpp.

◆ buttons() [2/2]

message_dialog & xtd::forms::message_dialog::buttons ( xtd::forms::message_dialog_buttons  buttons)
inline

Sets buttons to display in the message dialog.

Parameters
buttonsOne 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]

xtd::forms::message_dialog_default_button xtd::forms::message_dialog::default_button ( ) const
inline

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]

message_dialog & xtd::forms::message_dialog::default_button ( xtd::forms::message_dialog_default_button  default_button)
inline

Sets default button for the message dialog.

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

◆ dialog_result()

xtd::forms::dialog_result xtd::forms::message_dialog::dialog_result ( ) const
inline

Get async dialog_result result after dialog box is closing.

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

◆ dialog_style() [1/2]

xtd::forms::dialog_style xtd::forms::message_dialog::dialog_style ( ) const
inline

Gets the dialog style.

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

◆ dialog_style() [2/2]

message_dialog & xtd::forms::message_dialog::dialog_style ( xtd::forms::dialog_style  dialog_style)
inline

Sets the dialog style.

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

◆ display_help_button() [1/2]

bool xtd::forms::message_dialog::display_help_button ( ) const
inline

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]

message_dialog & xtd::forms::message_dialog::display_help_button ( bool  display_help_button)
inline

Sets a value indicate if help button is shown.

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

◆ icon() [1/2]

xtd::forms::message_dialog_icon xtd::forms::message_dialog::icon ( ) const
inline

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.
Examples
message_dialog.cpp.

◆ icon() [2/2]

message_dialog & xtd::forms::message_dialog::icon ( xtd::forms::message_dialog_icon  icon)
inline

Sets icon to display in the message dialog.

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

◆ message() [1/2]

xtd::ustring xtd::forms::message_dialog::message ( ) const
inline

Gets the text message.

Returns
The text message.
Examples
message_dialog.cpp.

◆ message() [2/2]

message_dialog & xtd::forms::message_dialog::message ( const xtd::ustring message)
inline

Sets the text message.

Parameters
messageThe text message.
Returns
Current message_dialog instance.

◆ options() [1/2]

xtd::forms::message_dialog_options xtd::forms::message_dialog::options ( ) const
inline

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]

message_dialog & xtd::forms::message_dialog::options ( xtd::forms::message_dialog_options  options)
inline

Sets options will be used for the message box.

Parameters
optionsOne 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.

◆ reset()

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

Resets all properties to empty string.

◆ show_dialog() [1/2]

xtd::forms::dialog_result xtd::forms::message_dialog::show_dialog ( )

Runs message dialog box.

◆ show_dialog() [2/2]

xtd::forms::dialog_result xtd::forms::message_dialog::show_dialog ( const iwin32_window owner)

Runs message dialog box.

◆ show_sheet()

void xtd::forms::message_dialog::show_sheet ( const iwin32_window owner)

Runs message dialog box.

◆ show_sheet_dialog()

xtd::forms::dialog_result xtd::forms::message_dialog::show_sheet_dialog ( const iwin32_window owner)

Runs message dialog box.

Examples
message_dialog.cpp.

◆ text() [1/2]

xtd::ustring xtd::forms::message_dialog::text ( ) const
inline

Gets the dialog caption text.

Returns
The current dialog caption text.
Examples
message_dialog.cpp.

◆ text() [2/2]

message_dialog & xtd::forms::message_dialog::text ( const xtd::ustring text)
inline

Sets the dialog caption text.

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

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