Servis-Rhino 4211B Guía de usuario Pagina 161

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 298
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 160
Menus
Dojo has extensive menu support. It provides both menu bar and context menus. Let us look first
at menu bars.
The code for the above looks as follows:
require(["dijit/MenuBar", "dijit/PopupMenuBarItem", "dijit/Menu", "dijit/MenuItem"],
function(MenuBar, PopupMenuBarItem, Menu, MenuItem)
{
var pMenuBar = new MenuBar({});
var pSubMenu1 = new Menu({});
pSubMenu1.addChild(new MenuItem({label: "Info 1"}));
pSubMenu1.addChild(new MenuItem({label: "Info 2"}));
pMenuBar.addChild(new PopupMenuBarItem({label: "info", popup: pSubMenu1}));
var pSubMenu2 = new Menu({});
pSubMenu2.addChild(new MenuItem({label: "Status 1"}));
pSubMenu2.addChild(new MenuItem({label: "Status 2"}));
pMenuBar.addChild(new PopupMenuBarItem({label: "Status", popup: pSubMenu2}));
pMenuBar.placeAt("wrapper");
pMenuBar.startup();
}
));
The high level philosophy is to create a MenuBar object to represent the menu bar. Next we create
as many Menu objects as we wish to appear within the MenuBar. For each Menu item we wish to
appear, we create and add child MenuItem objects which represent the individual selectable parts.
Each of the Menu items is added to the MenuBar. The MenuItem has an onClick event that is
called when the menu item is selected.
A Menu can also be used in the screen that is always visible. For example:
A snippet of this can be achieved with:
require(["dijit/Menu", "dijit/MenuItem"],
function(Menu, MenuItem)
{
var pMyMenu = new Menu({});
pMyMenu.addChild(new MenuItem({label: "Info 1"}));
pMyMenu.addChild(new MenuItem({label: "Info 2"}));
pMyMenu.placeAt("wrapper2");
}
Page 161
Vista de pagina 160
1 2 ... 156 157 158 159 160 161 162 163 164 165 166 ... 297 298

Comentarios a estos manuales

Sin comentarios