<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 41. 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>
edit

Methods

getCaption()
contextmenuitem.getCaption();
Gets the text string which is displayed for the menu item
Returns Type Description
  String the text string

setCaption()
contextmenuitem.setCaption(caption : String);
[Caution] This method is deprecated
Use setAttribute('caption', ...) instead.
Sets the text string which is displayed for the menu item
Parameter Name Type Description
caption String text string to display

setDelegate()
contextmenuitem.setDelegate(delegate : lz.handler);
[Caution] This method is deprecated
Use setAttribute('delegate', ...) instead.
Sets the delegate which will be called when the menu item is selected
Parameter Name Type Description
delegate lz.handler delegate which is executed when item is selected. An onselect event is also sent.

setEnabled()
contextmenuitem.setEnabled(val : boolean);
[Caution] This method is deprecated
Use setAttribute('enabled', ...) instead.
Sets the enabled status of the menu item
Parameter Name Type Description
val boolean if false, menu item is grayed out and will not respond to clicks

setSeparatorBefore()
contextmenuitem.setSeparatorBefore(val : boolean);
[Caution] This method is deprecated
Use setAttribute('separatorbefore', ...) instead.
Draw a horizontal separator line before this item in the menu
Parameter Name Type Description
val boolean sets visibility of separator line

setVisible()
contextmenuitem.setVisible(val : boolean);
[Caution] This method is deprecated
Use setAttribute('visible', ...) instead.
Sets the visibility of the menu item
Parameter Name Type Description
val boolean sets visibility

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