Project

General

Profile

Bug #2527 ยป SetPath.cpp

Koen Deforche, 02/07/2014 09:39 PM

 
#include <Wt/WApplication>
#include <Wt/WContainerWidget>
#include <Wt/WPushButton>
#include <Wt/WText>

using namespace Wt;

class MyApp : public WApplication
{
public:

MyApp(const WEnvironment& env)
: WApplication(env)
{
WPushButton* button = new WPushButton( "click to see alice", root() );
button->clicked().connect( this, &MyApp::changePath );
internalPathChanged().connect( this, &MyApp::handlePathChange );

setInternalPath("/login");
}

void changePath() { setInternalPath( "/alice/", true ); }

void handlePathChange( std::string path )
{
std::cout << "handlePathChange " << path << std::endl;
new WText( path, root() );
}
};

WApplication *createMyApplication(const WEnvironment& env)
{
return new MyApp(env);
}

int main(int argc, char **argv)
{
return WRun(argc, argv, &createMyApplication);
}
    (1-1/1)