<contextmenuitem>
A menu item within a context menu

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

The class <contextmenuitem> represents a menu item within a context menu.

Example 18. lz.contextmenuitem example

<canvas height="60">
   <view width="240" height="40" bgcolor="#aeaeae">
     <contextmenu>
       <contextmenuitem caption="menu item"/>
       <contextmenuitem caption="disabled menu item" enabled="false"/>
       <contextmenuitem caption="menu item with separator" separatorbefore="true"/>
     </contextmenu>
     <text align="center">Right click for context menu</text>
   </view>
 </canvas>

Attributes

Name (CSS property) Type (tag) Type (js) Default Category
caption string String   read/write
  Sets the text which is displayed for the menu item
delegate expression lz.handler   read/write
  Sets the delegate which will be called when the menu item is selected.
enabled boolean Boolean   read/write
  Sets the enabled status of the menu item. If false, the menu item is grayed out and will not respond to clicks
separatorbefore boolean Boolean   read/write
  Draw a horizontal separator line before this item in the menu.
visible boolean Boolean   read/write
  Sets the visibility of the menu item.

Methods

getCaption()
contextmenuitem.getCaption();
[Caution] This method is deprecated
Use caption instead
Gets the text string which is displayed for the menu item
Returns Type Description
  String the text string

Methods inherited from lz.Eventable

destroy, setAttribute

Events

Name Description
onselect Send when the menu item is selected

Events inherited from <node>

onconstruct, ondata, oninit

Events inherited from lz.Eventable

ondestroy