xtd - Reference Guide  0.1.0
Modern c++17/20 framework to create console, GUI and unit test applications on Windows, macOS, Linux, iOS and android.
Loading...
Searching...
No Matches
input_dialog_multiline.cpp

The following code example demonstrate the use of input_dialog dialog with multiline.

Windows

macOS

Gnome

#include <xtd/xtd>
using namespace xtd;
using namespace xtd::forms;
namespace examples {
class form1 : public form {
public:
form1() {
auto_scroll(true);
text("Input dialog multiline example");
controls().push_back_range({button1, label1});
button1.location({10, 10});
button1.auto_size(true);
button1.text("Lines...");
button1.click += [&] {
input_dialog.text("Enter lines");
input_dialog.value(label1.text());
if (input_dialog.show_dialog(*this) == dialog_result::ok)
label1.text(input_dialog.value());
};
label1.location({10, 50});
label1.auto_size(true);
label1.text("line 1\nline 2");
}
private:
button button1;
label label1;
};
}
int main() {
application::run(examples::form1());
}
Represents a Windows button control.
Definition: button.h:54
xtd::forms::dialog_result show_dialog()
Runs a common dialog box with a default owner.
Definition: common_dialog.h:60
Represents a window or dialog box that makes up an application's user interface.
Definition: form.h:40
Represents a common dialog box that displays input dialog.
Definition: input_dialog.h:30
bool multiline() const
Gets multiline status.
Definition: input_dialog.h:68
xtd::ustring value() const
Gets the value.
Definition: input_dialog.h:118
bool word_wrap() const
Gets word wrap status.
Definition: input_dialog.h:136
xtd::ustring text() const
Gets the dialog caption text.
Definition: input_dialog.h:93
Represents a standard Windows label.
Definition: label.h:26
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