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
message_box.cpp

The following code example demonstrate the use of message_box dialog.

Windows

macOS

Gnome

#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());
}
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
dialog_result
Specifies identifiers to indicate the return value of a dialog box.
Definition dialog_result.h:39
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