Hello, to access application, use WApplication::instance() static method. To convert WApplication* to pointer to your Application class (descendant of WApplication), use boost::polymorphic_cast (C++). I do not know Java and Ruby versions, but probably there is an equivalent.
Regards, Boris Nagaev On Tue, Jan 14, 2014 at 3:29 PM, Raphael Bauduin <rbli...@gmail.com> wrote: > Hi Boris, > > thx for your reply > > > On Tue, Jan 14, 2014 at 12:05 PM, Nagaev Boris <bnag...@gmail.com> wrote: >> >> Hello! >> >> You can pre-create all possible widgets and listed to the signal from >> each of them. Normally, all widgets are hidden. When path changes, >> needed widget (which matches current path) is shown, all other are >> hidden (which do not match current path). This is memory overhead, > > > If I understand correctly, each widget adds a listener on the application > instance's internalPathChanged? > (a quick look to the docs didn't reveal how the widget can access the app > instance, any suggestion?) > > I've seen WMenu has setInternalPathEnabled, I'll try that too. > > >> >> though. However, probably loading-time and CPU profit. Another method: >> to create central widget which would listen to path changes and >> replace its contents with appropriate widget created. Which method to >> use, depends of number of widgets, sessions and cost of memory and >> CPU. >> >> Regards, Boris Nagaev >> >> >> On Tue, Jan 14, 2014 at 2:53 PM, Raphael Bauduin <rbli...@gmail.com> >> wrote: >> > Hi, >> > >> > I have a JWt application made up of multiple independent widgets. I'm >> > not >> > currently handling internalPath, but want to do it. >> > >> > The JRuby code initialising the app's widgets is: >> > >> > # The widgets used >> > suggested_graphs = SuggestedGraphsWidget.new >> > collected_data = CollectedData.new >> > >> > top_bar = WNavigationBar.new(container) >> > top_bar.setTitle('Dashboard') >> > top_bar.setResponsive(true) >> > >> > # create content stack for the left menu, with the container as >> > parent >> > content_stack = WStackedWidget.new(container) >> > # create the menu with its content stack as parameter >> > left_menu = WMenu.new(content_stack) >> > # add items to the menu, with its corresponding widget >> > left_menu.add_item("Suggested Graphs",suggested_graphs) >> > left_menu.add_item("Collected data", collected_data) >> > left_menu.add_item("Other data", WText.new("Other data")) >> > # add the menu to the top bar >> > top_bar.add_menu(left_menu) >> > >> > container.addWidget(content_stack) >> > >> > I'm looking for advice about how I can best manage the internalPath. >> > From what I've read at http://www.webtoolkit.eu/widgets/navigation/ , it >> > seems >> > the way to go is an event listener app->internalPathChanged(). But this >> > listener then has to change the state of the widgets, which would result >> > in >> > non-self contained widgets. Is there a better solution? >> > >> > thx in advance! >> > >> > Raph >> > >> > >> > ------------------------------------------------------------------------------ >> > CenturyLink Cloud: The Leader in Enterprise Cloud Services. >> > Learn Why More Businesses Are Choosing CenturyLink Cloud For >> > Critical Workloads, Development Environments & Everything In Between. >> > Get a Quote or Start a Free Trial Today. >> > >> > http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk >> > _______________________________________________ >> > witty-interest mailing list >> > witty-interest@lists.sourceforge.net >> > https://lists.sourceforge.net/lists/listinfo/witty-interest >> > >> >> >> ------------------------------------------------------------------------------ >> CenturyLink Cloud: The Leader in Enterprise Cloud Services. >> Learn Why More Businesses Are Choosing CenturyLink Cloud For >> Critical Workloads, Development Environments & Everything In Between. >> Get a Quote or Start a Free Trial Today. >> >> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk >> _______________________________________________ >> witty-interest mailing list >> witty-interest@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/witty-interest > > > > > -- > Web database: http://www.myowndb.com > Free Software Developers Meeting: http://www.fosdem.org > > ------------------------------------------------------------------------------ > CenturyLink Cloud: The Leader in Enterprise Cloud Services. > Learn Why More Businesses Are Choosing CenturyLink Cloud For > Critical Workloads, Development Environments & Everything In Between. > Get a Quote or Start a Free Trial Today. > http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk > _______________________________________________ > witty-interest mailing list > witty-interest@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/witty-interest > ------------------------------------------------------------------------------ CenturyLink Cloud: The Leader in Enterprise Cloud Services. Learn Why More Businesses Are Choosing CenturyLink Cloud For Critical Workloads, Development Environments & Everything In Between. Get a Quote or Start a Free Trial Today. http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk _______________________________________________ witty-interest mailing list witty-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/witty-interest