<contextmenu>
A contextual menu

JavaScript: lz.contextmenu
extends <node> » lz.Eventable »

The <contextmenu> represents a context (right-click) menu.

Example 17. lz.contextmenu example

<canvas height="60">
   <view width="240" height="40" bgcolor="#aeaeae">
     <contextmenu>
       <contextmenuitem caption="menu item"/>
     </contextmenu>
     <text align="center">Right click for context menu</text>
   </view>
 </canvas>

Attributes

Name (CSS property) Type (tag) Type (js) Default Category
delegate expression lz.handler   read/write
  Sets the delegate which will be called when a menu item is selected. An onselect event is also sent.

Methods

addItem()
contextmenu.addItem(item : lz.contextmenuitem);
Adds a menu items into a menu
Parameter Name Type Description
item lz.contextmenuitem menu item to install on this menu

clearItems()
contextmenu.clearItems();
Remove all custom items from a menu

filterItems()
contextmenu.filterItems(target : lz.view);
Return list of custom menu items. This method is called when the context menu is opened to build the menu display. Because it is called each time the menu is opened, this method can be overridden to dynamically update the menu based on current state.
Parameter Name Type Description
target lz.view The view over which the context menu is being requested, null if no view applies.
Returns Type Description
  [lz.contextmenuitem] The items that should be displayed in the context menu

getItems()
contextmenu.getItems();
Return list of custom items
Returns Type Description
  [lz.contextmenuitem] all custom items

hideBuiltInItems()
contextmenu.hideBuiltInItems();
Removes Flash-installed default menu items

makeMenuItem()
contextmenu.makeMenuItem(title : String, delegate : lz.handler);
Create a new menu item for a lz.contextmenu
Parameter Name Type Description
title String menu item name
delegate lz.handler delegate to execute when item is selected
Returns Type Description
  lz.contextmenuitem the new menu item

showBuiltInItems()
contextmenu.showBuiltInItems();
Shows Flash-installed default menu items

Methods inherited from lz.Eventable

destroy, setAttribute

Events

Name Description
onmenuopen Send when the menu is opened

Events inherited from <node>

onconstruct, ondata, oninit

Events inherited from lz.Eventable

ondestroy