Community
Participate
Working Groups
I introduced a "choices" menu in the command framework as part of implementing the file move/copy. A command can supply choices into a submenu. Currently the menu is built when the parent menu is rendered. This needs to be populated on the fly, both for performance reasons, and also accuracy so that the choices depend on the state at the moment. This is straightforward to do with dijit contextmenu _openMyself but I did not find the equivalent for a popup submenu item. I found a snippet using _openPopup which has to be hooked on the parent menu. This requires something like: dojo.connect(parentMenu, "_openPopup", command, function(event) { var item = parent.focusedChild; var popup = item.popup; // delete items in popup and add new ones. }); this didn't immediately work and is also kind of bogus because then we'd have to keep track of whether we had already installed this listener on the parent, or else always hook it even if the parent didn't need dynamic menus. Seems like there should be a way to hook something like _openMyself on the popup menu's submenu but it did not work, and I had to move on...
see also bug 342739. rather than expose "choices" as a concept in the framework, we should probably just generalize the "popup off of a menu" concept
fixed. It seems that _openMyself is used only with context menus. So in the command framework, we had to connect to events associated with the parent. For a PopupMenuItem, connect to the parent menu and hook _openPopup. For drop down buttons, connect to the button and hook onClick