Hello,
I'm trying to use a WTabWidget to implement a navigation tool bar
(basically a horizontal menu, where when a tab is clicked, it loads
different content. The problem I have is that the way that WMenu and
WTabWidget work is that you create a menu/tab item, and then pass in a
WWidget* that you want to have displayed when the user clicks the menu
item and the menu control itself takes care of positioning the widget
either below or to the side of the menu.
What I want to do is to be able to take control of where the widget is
positioned on the page without regard to the position of the actual menu
itself, so what I did was I passed in NULL pointers to the addTab, I
stored the index along with the widget i wanted associated with that tab
and connected the currentChanged event to a handler, that would look up
the widget from a std::map, remove the old widget from being displayed,
and add in the new widget.
Like this:
void navBarChanged(int tabClicked)
{
Wt::WLayoutItem *item = layout->itemAt(Wt::WBorderLayout::Center);
layout->removeItem(item);
layout->addWidget(tabbedControls[tabClicked],
Wt::WBorderLayout::Center);
}
layout is a WHBoxLayout.
My goal is to make my navigation bar decoupled from the rest of the
layout of the site and make one main component responsible for all
layout logic.
However, after implementing the solution I described, I discovered that
removing and a new item to the layout does not actually cause it to be
displayed.
Any suggestions on how to go about dynamically adding and removing
content to a layout?
Thanks.
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest