LL - Help

Home

Menu script

Default: None

This event is meant to be configured with a script to customize the popup menu displayed for an item or container. It will be ignored if the action is not a script. The script is called as a function with these arguments:

Being called as a function, this script is not able to access the current event.

Example script:

// function to execute when a menu item is clicked
function handler(v) {
    // close the menu and display the selected item as well as the text of the selected menu item
    menu.close();
    alert(item+" / " + v.getText());
}

// it is possible to read the current menu mode and configure it accordingly
if(menu.getMode() == Menu.MODE_ITEM_NO_EM) {
  // optional, clear the content of the menu, comment this line to keep the standard items before to add new ones
  menu.getMainItemsView().removeAllViews();

  // add a few items
  menu.addMainItem("Hello", handler);
  menu.addMainItem("Goodbye", handler);
}