What I ended up doing was copy/pasting WTabWidget, as I didn't want to also be responsible for coding all of the look and feel code too. I think in a future version of Wt, perhaps there should be a field to provide ones own stackedwidget to WTabWidget.
On 10/26/2010 2:06 AM, Dmitriy Igrishin wrote: > Hey Raindog, > > WTabWidget - is a ready to use widget which uses WMenu with specific > styling. If you need full control of contents stack (aka WStackedWidget) > you can use pure WMenu and WStackedWidget. > > 2010/10/26 Raindog <[email protected] > <mailto:[email protected]>> > > On 10/26/2010 1:03 AM, Raindog wrote: > > 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. > > > > > > > > So I've done some more searching and it looks like what I would really > need is the ability to set the WStackedWidget in WTabWidget to one > that > I have already constructed, and hence can give to a layout of my > choosing. Since the parts of the WTabWidget interface that are > important > are private, besides copy paste and creating a MyTabWidget, does > anyone > have any other suggestions that I can do to accomplish this? > > 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] > <mailto:[email protected]> > https://lists.sourceforge.net/lists/listinfo/witty-interest > > > > > -- > // Dmitriy. > > > > ------------------------------------------------------------------------------ > 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 > ------------------------------------------------------------------------------ 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
