xtd 0.2.0
input_box.cpp

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

Windows

macOS

Gnome

#include <xtd/forms/application>
#include <xtd/forms/button>
#include <xtd/forms/form>
#include <xtd/forms/input_box>
#include <xtd/forms/label>
using namespace xtd::forms;
namespace input_box_example {
class form1 : public form {
public:
form1() {
text("Input box example");
controls().push_back_range({button1, label1});
button1.location({10, 10});
button1.text("Text...");
button1.click += [&] {
auto value = label1.text();
if (input_box::show(value, *this, "Message text", "Caption text") == dialog_result::ok)
label1.text(value);
};
label1.location({10, 50});
label1.auto_size(true);
label1.text("Default value");
}
private:
label label1;
};
}
auto main() -> int {
application::run(input_box_example::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
static xtd::forms::dialog_result show(xtd::string &value, const xtd::forms::iwin32_window &owner)
Displays an input box in front of the specified window. The input box displays a text value.
Represents a standard Windows label.
Definition label.hpp:38
@ ok
The dialog box return value is OK (usually sent from a button labeled OK).
Definition dialog_result.hpp:47
@ button1
The first button on the message box is the default button.
Definition message_dialog_default_button.hpp:24
@ text
The xtd::forms::status_bar_panel displays text in the standard font.
Definition status_bar_panel_style.hpp:25
The xtd::forms namespace contains classes for creating Windows-based applications that take full adva...
Definition texts.hpp:217