Hello!

I noticed that LazyLoading in WMenu does not work.
Content always loading as though PreLoading activated, but i make
WMenuItems with LazyLoading option.

Here is example:

#include <iostream>
#include <Wt/WApplication>
#include <Wt/WMenu>
#include <Wt/WStackedWidget>
#include <WT/WText>

using namespace Wt;

class Page1 : public WContainerWidget
{
public:
        Page1()
        {
                addWidget(new WText("this is page1"));
                std::cout << "Page1 is loaded" << std::endl;
        }
};

class Page2 : public WContainerWidget
{
public:
        Page2()
        {
                addWidget(new WText("this is page2"));
                std::cout << "Page2 is loaded" << std::endl;
        }
};

class MyApp : public WApplication
{
public:
        MyApp(const WEnvironment& env)
        : WApplication(env)
        {
                WStackedWidget* contents = new WStackedWidget();
                WMenu* menu = new WMenu(contents, Horizontal);
                
                root()->addWidget(menu);
                root()->addWidget(contents);
                
                menu->addItem("page1", new Page1(), WMenuItem::LazyLoading);
                menu->addItem("page2", new Page2(), WMenuItem::LazyLoading);
        }
};

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

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


Regards,
Aleksey

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to