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.
date_time_picker.cpp

The following code example demonstrate the use of date_time_picker picker.

Windows
date_time_picker_w.png

date_time_picker_wd.png
macOS
date_time_picker_m.png

date_time_picker_md.png
Gnome
date_time_picker_g.png

date_time_picker_gd.png
#include <xtd/xtd>
using namespace xtd;
using namespace xtd::forms;
class form1 : public form {
public:
form1() {
text("Date time picker example");
controls().push_back_range({picker1, label1, picker2, label2});
picker1.location({10, 10});
picker1.value_changed += [&] {
label1.text(ustring::format("{:d}", picker1.value()));
};
picker1.max_date(std::chrono::system_clock::now());
picker1.min_date(1975, 4, 4);
picker1.value(1975, 4, 4);
label1.location({10, 50});
label1.size({380, 340});
picker2.location({10, 90});
picker2.value_changed += [&] {
label2.text(ustring::format("{:t}", picker2.value()));
};
picker2.max_date(1970, 1, 1, 13, 59, 59);
picker2.min_date(1970, 1, 1, 12, 0, 0);
picker2.value(1970, 1, 1, 13, 0, 0);
label2.location({10, 130});
label2.size({380, 340});
}
private:
label label1;
label label2;
};
int main() {
application::run(form1());
}