Package: libwt27
Version: 3.1.8-2
Hi,
The attached example will show "Home" instead of "Test", when
you go to the url of the binary with "/test2" after it. So that
means that bookmarking that url doesn't work.
In the log file it will show:
[error] "WMenu: unknown path: 'test2'"
If you change "test2" in the code to "test", everything works
as expected. As far as I understand "test" is the default value.
Kurt
#include <Wt/WApplication>
#include <Wt/WStackedWidget>
#include <Wt/WMenu>
#include <Wt/WText>
using namespace Wt;
class Test : public WApplication
{
public:
Test(const WEnvironment& env);
private:
WMenu *MainMenu;
};
Test::Test(const WEnvironment& env) : WApplication(env)
{
WStackedWidget *contents = new WStackedWidget();
contents->setId("main_page");
MainMenu = new WMenu(contents, Horizontal);
MainMenu->setRenderAsList(true);
MainMenu->setInternalPathEnabled();
MainMenu->setInternalBasePath("/");
MainMenu->addItem(WString("Home"), new WText("Home"))->setPathComponent("");
MainMenu->addItem(WString("Test"), new WText("Test"))->setPathComponent("test2");
root()->addWidget(MainMenu);
root()->addWidget(contents);
}
WApplication *createApplication(const WEnvironment& env)
{
return new Test(env);
}
int main(int argc, char *argv[])
{
return WRun(argc, argv, &createApplication);
}