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

The following code example demonstrate the use of numeric up down control.

Windows
numeric_up_down_w.png

numeric_up_down_wd.png
macOS
numeric_up_down_m.png

numeric_up_down_md.png
Gnome
numeric_up_down_g.png

numeric_up_down_gd.png
#include <xtd/xtd>
using namespace xtd;
using namespace xtd::forms;
namespace examples {
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(ustring::format("value = {}", numeric_up_down1.value()));
};
numeric_up_down1.text_changed += [&] {
cdebug << ustring::format("text = {}", numeric_up_down1.text()) << std::endl;
};
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;
};
}
int main() {
application::run(examples::form1());
}