Project

General

Profile

Bug #13805 ยป slider_demo.cpp

Stephan Kerker, 06/27/2025 11:40 AM

 
#include <Wt/WApplication.h>
#include <Wt/WBreak.h>
#include <Wt/WContainerWidget.h>
#include <Wt/WLineEdit.h>
#include <Wt/WPushButton.h>
#include <Wt/WText.h>
#include <Wt/WSlider.h>

class HelloApplication : public Wt::WApplication
{
public:
HelloApplication(const Wt::WEnvironment& env);
};

HelloApplication::HelloApplication(const Wt::WEnvironment& env)
: Wt::WApplication(env)
{
setTitle("Hello world");

Wt::WSlider* pSlider = new Wt::WSlider();

pSlider->valueChanged().connect(std::bind(
[this](int value)
{
std::cout << "new value: " << value << std::endl;
},
std::placeholders::_1));
root()->addWidget(std::unique_ptr<Wt::WSlider>(pSlider));

}

int main(int argc, char **argv)
{
return Wt::WRun(argc, argv, [](const Wt::WEnvironment& env) {
return std::make_unique<HelloApplication>(env);
});
}
    (1-1/1)