Hey Brad, 2008/11/9 Brad Hubbard <[EMAIL PROTECTED]>: > The following appears to produce a vertically oriented menu where I > would expect to see horizontal orientation. Is this right?
You are right. It should be horizontal. However, the menu was not conceived with submenu's in a horizontal layout in mind. Three changes are needed: - update to latest CVS: I now enforce menu items to be inline when in a horizontal layout - you need to render the sub menu's using <ul> and <li> elements (setRenderAsList()). This is probably a good idea in general since it is a kind of web convention... - make those <ul> and <li> elements inline > WContainerWidget* menu_area = new WContainerWidget( root() ); > WStackedWidget* contents = new WStackedWidget( root() ); > WMenu* menu = new WMenu( contents, Horizontal, menu_area ); > > WSubMenuItem* smi = new WSubMenuItem( "Menu1", new WText( "Menu1" ) ); > WMenu* subMenu = new WMenu( contents, Horizontal, 0 ); subMenu->setRenderAsList(true); subMenu->setStyleClass("horiz-menu"); > subMenu->addItem( "Sub1", new WText( "Sub1" ) ); > subMenu->addItem( "Sub2", new WText( "Sub2" ) ); > subMenu->addItem( "Sub3", new WText( "Sub3" ) ); > subMenu->addItem( "Sub4", new WText( "Sub4" ) ); > subMenu->addItem( "Sub5", new WText( "Sub5" ) ); > smi->setSubMenu(subMenu); > menu->addItem(smi); > > smi = new WSubMenuItem( "Menu2", new WText( "Menu2" ) ); > subMenu = new WMenu( contents, Horizontal, 0 ); subMenu->setRenderAsList(true); subMenu->setStyleClass("horiz-menu"); > subMenu->addItem( "Sub1", new WText( "Sub1" ) ); > subMenu->addItem( "Sub2", new WText( "Sub2" ) ); > subMenu->addItem( "Sub3", new WText( "Sub3" ) ); > subMenu->addItem( "Sub4", new WText( "Sub4" ) ); > subMenu->addItem( "Sub5", new WText( "Sub5" ) ); > smi->setSubMenu(subMenu); > menu->addItem(smi); styleSheet().addRule("ul.horiz-menu", "display: inline;"); styleSheet().addRule("ul.horiz-menu li", "display: inline;"); However, the result is still not very good looking: everything is now rendered on a single line. How do we want these sub menu's to look ? Probably like this, on two lines: ? Menu1 Menu2 Sub1 Sub2 Sub3 Sub4 Sub5 That will need some more implementation work in WSubMenuItem.C Regards, koen ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ witty-interest mailing list witty-interest@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/witty-interest