Bug #1036
closedWMenuItem path component and menu internal paths
0%
Description
I have following code:
#define MIR_IPATH_SIGNIN "menu_signin"
#define MIR_IPATH_MUSICROBOT "menu_musicrobot"
#define MIR_IPATH_USERS "menu_users"
#define MIR_IPATH_USERS_ADD_USER "menu_users_add_user"
#define MIR_IPATH_EXPLORER "menu_explorer"
#define MIR_IPATH_SEARCHENGINE "menu_searchengine"
#define MIR_IPATH_SIGNOUT "menu_signout"
#define MIR_IPATH_SETTINGS "menu_settings"
#define MIR_IPATH_SETTINGS_EXPORT "menu_settings_export"
...
WMenu *menu = new WMenu(this->m_contentsStack_, Horizontal, 0);
menu->setRenderAsList(true);
menu->setStyleClass(MIR_STRCAT3(MIR_CSS_MENU_DROPDOWN, " ", MIR_CSS_MENU));
menu->setInternalPathEnabled();
//menu->setInternalBasePath("/");
WMenuItem *mi;
// tutaj tworzę wszystkie dostępne menu, ale schowane (tzn. WMenuItem->hide())
mi = menu->addItem(tr(MIR_MENU_SIGNIN), new LoginControls(this->m_app, menu, this->m_dm, WApplication::instance()->internalPath(), true, MIR_STRINGIFY(MIR_CSS_MARGIN_FOR_ANIM)));
mi->itemWidget()->setStyleClass(MIR_STRINGIFY(MIR_CSS_MENU_SELECTED_ITEM));
mi->setPathComponent(MIR_IPATH_SIGNIN);
mi = this->addToMenu(menu, tr(MIR_MENU_EXPLORER), new ExplorerControls(this->m_app, menu, this->m_dm, MIR_STRINGIFY(MIR_CSS_MARGIN_FOR_ANIM)));
mi->setPathComponent(MIR_IPATH_EXPLORER);
mi = this->addToMenu(menu, tr(MIR_MENU_SETTINGS), new SettingsControls(this->m_app, menu, this->m_dm, MIR_STRINGIFY(MIR_CSS_MARGIN_FOR_ANIM)));
mi->setPathComponent(MIR_IPATH_SETTINGS);
mi->itemWidget()->parent()->setStyleClass(MIR_STRINGIFY(MIR_CSS_MENU_DIR));
Menu item MIR_IPATH_SETTINGS has a submenu. When i click on MIR_IPATH_SETTINGS or its submenu menu items i have following warnings:
[2011-Oct-23 18:07:59.102282] 12510 [/SyNaTPG.wt aAzMpHkh5GFth06J] [warn] "WMenu: unknown path: 'menu_settings/'"
127.0.0.1 - - [2011-Oct-23 18:07:59.107020] "POST /SyNaTPG.wt?wtd=aAzMpHkh5GFth06J HTTP/1.1" 200 505
[2011-Oct-23 18:08:21.397267] 12510 [/SyNaTPG.wt aAzMpHkh5GFth06J] [warn] "WMenu: unknown path: 'menu_settings_export/'"
In my scenario every menu item has a flat internal paths that is internal path to submenu item MIR_IPATH_SETTINGS_EXPORT is 'menu_settings_export' and not 'menu_settings/menu_settings_export'. This done intentionally to not trigger menuItemSelected twice (once for menu and once for submenu... yes i have menuItemSelected in submenu).
Updated by Koen Deforche about 13 years ago
- Status changed from New to Feedback
- Assignee set to Koen Deforche
- Target version set to 3.2.0
Hey,
So, if I understand correclty, the submenus are deployed at the same internal path "/" as the main menu? I can see how that gives problems.
But why do you want this? Nested menus work well, see for example the widget gallery and homepage examples ?
Regards,
koen
Updated by Koen Deforche almost 13 years ago
- Status changed from Feedback to Closed
Closed, won't fix this use of internal paths in menus.