Project

General

Profile

Bug #1165 ยป hello.C

Michael Vilsker, 02/14/2012 02:07 PM

 

#include <Wt/WApplication>
#include <Wt/WBreak>
#include <Wt/WContainerWidget>
#include <Wt/WLineEdit>
#include <Wt/WPushButton>
#include <Wt/WText>
#include <Wt/WString>
#include <Wt/WInPlaceEdit>
#include <Wt/WComboBox>

// c++0x only, for std::bind
// #include <functional>

using namespace Wt;

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

HelloApplication::HelloApplication(const WEnvironment& env)
: WApplication(env)
{
Wt::WComboBox *combo = new Wt::WComboBox(root());
combo->addItem("item1");
combo->addItem("item2");
WString currentIndex =
boost::lexical_cast<std::string>( combo->currentIndex() );
new WText("<br /> combo->currentIndex() = " + currentIndex +
".<br /> item1 is selected so combo->currentIndex() should be 0",
root());
}

WApplication *createApplication(const WEnvironment& env)
{
return new HelloApplication(env);
}

int main(int argc, char **argv)
{
return WRun(argc, argv, &createApplication);
}

    (1-1/1)