xtd - Reference Guide  0.1.1
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
input_dialog.cpp

The following code example demonstrate the use of input_dialog dialog.

Windows

macOS

Gnome

#include <xtd/xtd>
using namespace xtd;
using namespace xtd::forms;
namespace examples {
class form1 : public form {
public:
form1() {
text("Input dialog example");
controls().push_back_range({button1, label1});
button1.location({10, 10});
button1.text("Text...");
button1.click += [&] {
input_dialog input_dialog;
input_dialog.text("Caption text");
input_dialog.message("Message text");
input_dialog.value(label1.text());
if (input_dialog.show_sheet_dialog(*this) == dialog_result::ok)
label1.text(input_dialog.value());
};
label1.location({10, 50});
label1.auto_size(true);
label1.text("Default value");
}
private:
label label1;
};
}
int main() {
application::run(examples::form1());
}
static void run()
Begins running a standard application message loop on the current thread, without a form.
@ ok
The dialog box return value is OK (usually sent from a button labeled OK).
@ button1
The first button on the message box is the default button.
@ button
The appearance of a button.
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