xtd 0.2.0
Loading...
Searching...
No Matches
dialog.cpp

demonstrates the use of xtd::forms::form container as dialog.

Windows

macOS

Gnome

#include <xtd/drawing/texts>
#include <xtd/forms/application>
#include <xtd/forms/button>
#include <xtd/forms/form>
using namespace xtd::forms;
class dialog : public form {
public:
dialog() {
accept_button(ok_button);
client_size({195, 75});
minimize_box(false);
text("Dialog");
ok_button.dialog_result(dialog_result::ok);
ok_button.location({60, 40});
ok_button.parent(*this);
ok_button.text(xtd::drawing::texts::ok());
}
public:
button ok_button;
};
auto main() -> int {
form.text("Dialog example");
button.location({10, 10});
button.text("Dialog...");
button.click += [&] {
dialog().show_dialog(form);
};
application::run(form);
}
static xtd::string ok()
Gets a system-defined text that has a string value of "&OK". This field is constant.
Represents a Windows button control.
Definition button.h:49
virtual drawing::point location() const noexcept
Gets the coordinates of the upper-left corner of the control relative to the upper-left corner of its...
event< control, event_handler > click
Occurs when the xtd::forms::control is clicked.
Definition control.h:1485
virtual const xtd::string & text() const noexcept
Gets the text associated with this control.
virtual std::optional< control_ref > parent() const noexcept
Gets the parent container of the control.
Represents a window or dialog box that makes up an application's user interface.
Definition form.h:54
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition xtd_about_box.h:12