Project

General

Profile

Bug #6321 ยป issue_6321.cpp

Roel Standaert, 04/09/2018 12:20 PM

 
#include <Wt/WApplication.h>
#include <Wt/WContainerWidget.h>
#include <Wt/WFileResource.h>
#include <Wt/WLink.h>
#include <Wt/WPushButton.h>
#include <Wt/WServer.h>

struct application : Wt::WApplication {
application(const Wt::WEnvironment &env)
: Wt::WApplication{env}
{
file_ = std::make_shared<Wt::WFileResource>();
downloadButton_ = root()->addNew<Wt::WPushButton>("Download!");
downloadButton_->setLink(Wt::WLink{file_});

auto changeFile = root()->addNew<Wt::WPushButton>("Set file");
changeFile->clicked().connect([this](){
file_->setFileName("/tmp/Wt 3.3.10 RC 1/Wt-3.3.10-rc1-msvs2010-Windows-x86-SDK.zip");
file_->suggestFileName("Wt-3.3.10-rc1-msvs2010-Windows-x86-SDK.zip");
});
}

private:
std::shared_ptr<Wt::WFileResource> file_;
Wt::WPushButton *downloadButton_;
};

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