Hello! To have only one widget (central widget) instance in memory, you can add WContainerWidget to root(). Connect signal wApp->internalPathChanged() to your function. In this function you will call clear() method of WContainerWidget, parse URL, create new central widget and add it to WContainerWidget. So most one central widget will present simultaneously.
If you have 1000 anchors, it makes sense to keep in memory only those of them which are visible currently. See WTableView and LinkRole in Wt documentation for this. multiple links and always have just only one class (the last clicked) in memory On Tue, Nov 6, 2012 at 1:05 AM, John Robson <[email protected]> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Is perfect. Thank you very much. I'll think about your tip. > > > One question: suppose I have 1000 links, each link instantiates a Class > and performs some Function(s). > > If a user clicks on these 1000 links; they all remain forever in the > memory?!! > > Regardless if I use WMenu or WAnchor? > > Which is better solution to have multiple links and always have just > only one class (the last clicked) in memory? > > (perhaps calling delete every time a new link is clicked?) > > John > > > On 11/05/2012 03:48 AM, Nagaev Boris wrote: >> I have done this here: >> https://github.com/starius/Wt-Tests/blob/master/WStackedWidget/test.cpp >> >> I think, that better way of doing what you want is using internal >> paths of application. Just create several instances of WAnchor, >> connect them to internal paths like "/help/", "/about/". Then connect >> wApp->internalPathChanged() signal to function, which would parse >> internal path, create appropriate widget and set it as central widget. >> In this case no memory will be spend for widgets except one that is >> currently set. I have tried several other ways (including >> WStackedWidget) and came to the conclusion that method I proposed is >> the simpest. > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2.0.19 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iQEcBAEBAgAGBQJQmCoOAAoJEOjf7XlrDgBAsd4IAJ3bb+3WJ8rCGM4ZeMo1NELa > 1/H7vWrst96kXIka+D9F6xNVt/2UVe25OiChSPYa0Pq4fvu7Np1ChKjpf3lAyuWn > 7d0RWGzEM5k4uOjiqliXiecrK11OyURcBn8H0X6JnJ8aXFO2w052jMe5rs/l4niT > dVJsSscOZIfSl3PZLYtMb6eJvoYQQKA4OqK1atyjKwnTHr+ozCYRourxTzQMll4v > TGo8J4nSDPFcBwuDOZkW0nY+8cRpHvPOYFNzpZl8HFHyS8m1fOHzbN/7FHubHBeD > klv3ChwJ7yyaLcShzda1H2ayJ7IAgvEuKu2x6E1+hstyalKOSVggpy3lBHtBNQc= > =zIov > -----END PGP SIGNATURE----- > > > ------------------------------------------------------------------------------ > LogMeIn Central: Instant, anywhere, Remote PC access and management. > Stay in control, update software, and manage PCs from one command center > Diagnose problems and improve visibility into emerging IT issues > Automate, monitor and manage. Do more in less time with Central > http://p.sf.net/sfu/logmein12331_d2d > _______________________________________________ > witty-interest mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/witty-interest ------------------------------------------------------------------------------ LogMeIn Central: Instant, anywhere, Remote PC access and management. Stay in control, update software, and manage PCs from one command center Diagnose problems and improve visibility into emerging IT issues Automate, monitor and manage. Do more in less time with Central http://p.sf.net/sfu/logmein12331_d2d _______________________________________________ witty-interest mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/witty-interest
