Project

General

Profile

Bug #7197 » spinbox_valueChanged.cpp

test to reproduce it (Wt 3) - Roel Standaert, 08/14/2019 12:57 PM

 
#include <Wt/WApplication>
#include <Wt/WBreak>
#include <Wt/WContainerWidget>
#include <Wt/WDoubleSpinBox>
#include <Wt/WPushButton>
#include <Wt/WServer>
#include <Wt/WSpinBox>

#include <functional>
#include <iostream>

int main(int argc, char **argv)
{
return Wt::WRun(argc, argv, [](const Wt::WEnvironment &env) {
auto app = new Wt::WApplication(env);
auto root = app->root();

auto intSpin = new Wt::WSpinBox(root);
auto dblSpin = new Wt::WDoubleSpinBox(root);

new Wt::WBreak(root);

auto connectBtn = new Wt::WPushButton(Wt::utf8("Connect signals"), root);

connectBtn->clicked().connect(std::bind([intSpin, dblSpin]{
intSpin->valueChanged().connect(std::bind([](int value){
std::cout << "spinbox value changed to: " << value << '\n';
}, std::placeholders::_1));

dblSpin->valueChanged().connect(std::bind([](double value){
std::cout << "double spinbox value changed to: " << value << '\n';
}, std::placeholders::_1));
}));

return app;
});
}
(2-2/2)