xtd 0.2.0
message_box.cpp

demonstrates the use of xtd::forms::message_box dialog.

Windows

macOS

Gnome

#include <xtd/forms/application>
#include <xtd/forms/button>
#include <xtd/forms/form>
#include <xtd/forms/label>
#include <xtd/forms/message_box>
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 += [&] {
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 {});
}
static void run()
Begins running a standard application message loop on the current thread, without a form.
Represents a Windows button control.
Definition button.hpp:49
Represents a window or dialog box that makes up an application's user interface.
Definition form.hpp:54
Represents a standard Windows label.
Definition label.hpp:38
static dialog_result show(const iwin32_window &owner)
Displays a message box in front of the specified window.
@ warning
The message box contains a symbol consisting of an exclamation point in a triangle with a yellow back...
Definition message_dialog_icon.hpp:30
@ location
Specifies that both the x and y coordinates of the control are defined.
Definition bounds_specified.hpp:30
@ ok_cancel
The message box contains OK and Cancel buttons.
Definition message_dialog_buttons.hpp:26
@ manual
The position of the form is determined by the Location property.
Definition form_start_position.hpp:24
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition texts.hpp:217
Contains classes that represent ASCII and Unicode character encodings; abstract base classes for conv...
Definition basic_string_builder.hpp:16
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8