Hi Koen,

You right.  I used booth wrapView and deferCreate (although I still do
not know perfectly the difference between them):

MTop::MTop(WStackedWidget *parent) {
  WMenu *menu = new WMenu(parent, Wt::Horizontal, this);
  menu->addItem("Home", wrapView(&MTop::home));
  menu->addItem("Albums", deferCreate(boost::bind(&MTop::albums, this)));
}

WWidget *MTop::wrapView(WWidget *(MTop::*createWidget)()) {
  return makeStaticModel(boost::bind(createWidget, this));
}


I still have some doubts.

1) if another user (or me) to insert a new 'Album', what I gotta do to
get my album page refresh itself? (c++ events?)

2) if I have several cpp pages, I have to enter all in the
WStackedWidget? But I do not want all in the WMenu, only the most
important links.

3) if a user clicks on several links, all pages will stay in memory?!
Would not it be better to show the page and release it from memory?

I'll study the examples again, but still have not found these answers.


My goal is to build a large site with many links IN and OUT of menus,
each with a Different URL, so if the user Clicks on a link or Typing
directly the URL; the site will display the desired content in the center.

Similar to these:
http://www.cplusplus.com/doc/tutorial/structures/

main: http://www.cplusplus.com/
documentation: http://www.cplusplus.com/doc/
tutorial (all topics): http://www.cplusplus.com/doc/tutorial/
desired topic: http://www.cplusplus.com/doc/tutorial/structures/

Perhaps: doc.cpp call tutorial.cpp ?!  and tutorial.cpp load from a XML
ou DB.


Do you think wt-homepage fits well into this idea?


Sorry my naive questions, but I'm still trying to assemble the Wt jigsaw
puzzle.  ;)

John

On 05/24/2011 05:29 AM, Koen Deforche wrote:
> Hey John,
> 
> I believe it is a misconception that WMenu+WStackedWidget preloads all
> the contents in memory and/or in the browser.
> There are several ways to avoid the overhead server-side or
> client-side, using WMenu and WStackedWidget.
> 
> The wt-homepage (and to a lesser extent, widget gallery) use the
> following tricks.
>  - use an intermediate placeholder for the contents which creates the
> contents only when it gets loaded (deferCreate()).
>  - use a WViewWidget to avoid server-side resources for view-only contents.
> 
> Regards,
> koen


------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to