xtd 0.2.0
numeric_up_down.cpp

demonstrates the use of xtd::forms::numeric_up_down control.

Windows

macOS

Gnome

#include <xtd/forms/application>
#include <xtd/forms/form>
#include <xtd/forms/label>
#include <xtd/forms/numeric_up_down>
#include <xtd/cdebug>
using namespace xtd;
using namespace xtd::forms;
namespace numeric_up_down_example {
class form1 : public form {
public:
form1() {
text("Numeric up down example");
active_control(numeric_up_down1);
numeric_up_down1.parent(*this);
numeric_up_down1.location({80, 50});
numeric_up_down1.wrapped(true);
numeric_up_down1.value_changed += [&] {
label1.text(string::format("value = {}", numeric_up_down1.value()));
};
numeric_up_down1.text_changed += [&] {
cdebug << string::format("text = {}", numeric_up_down1.text()) << environment::new_line;
};
numeric_up_down1.value(50);
numeric_up_down2.parent(*this);
numeric_up_down2.location({80, 100});
numeric_up_down2.decimal_place(2);
numeric_up_down2.increment(.01);
numeric_up_down2.minimum(10.0);
numeric_up_down2.maximum(11.0);
label1.parent(*this);
label1.location({80, 150});
}
private:
numeric_up_down numeric_up_down1;
numeric_up_down numeric_up_down2;
label label1;
};
}
auto main() -> int {
application::run(numeric_up_down_example::form1 {});
}
static xtd::string new_line() noexcept
Gets the newline string defined for this environment.
static void run()
Begins running a standard application message loop on the current thread, without a form.
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
Represents a standard Windows numeric up down.
Definition numeric_up_down.hpp:34
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