| Package | Top Level |
| Class | public class MenuItem |
See also
| Method | Defined by | ||
|---|---|---|---|
|
MenuItem(text:String)
Constructor.
| MenuItem | ||
|
getId():String
Gets the id of the menu item.
| MenuItem | ||
|
getOnSelected():String
Gets the "onSelected" event handler.
| MenuItem | ||
|
getTag():String
Gets the tag property of the menu item.
| MenuItem | ||
|
getText():String
Gets the text (label) property of the menu item.
| MenuItem | ||
|
setId(id:String):void
Sets the id of the menu item.
| MenuItem | ||
|
setOnSelected(functionName:String):void
Sets the "onSelected" event handler.
| MenuItem | ||
|
setTag(tag:String):void
Sets the tag property of the menu item.
| MenuItem | ||
|
setText(text:String):void
Sets the text (label) property of the menu item.
| MenuItem | ||
| MenuItem | () | constructor |
public function MenuItem(text:String)Constructor.
Parameterstext:String — The text (label) of the menu item.
|
| getId | () | method |
public function getId():StringGets the id of the menu item.
ReturnsString — Menu item ID.
|
| getOnSelected | () | method |
public function getOnSelected():StringGets the "onSelected" event handler.
ReturnsString — Name of the menu item event handler.
|
| getTag | () | method |
public function getTag():StringGets the tag property of the menu item.
ReturnsString — Menu item tag.
|
| getText | () | method |
public function getText():StringGets the text (label) property of the menu item.
ReturnsString — Menu item text.
|
| setId | () | method |
public function setId(id:String):voidSets the id of the menu item. The menu item ID is user-defined and can be any string.
Parametersid:String — Menu item ID.
|
| setOnSelected | () | method |
public function setOnSelected(functionName:String):voidSets the "onSelected" event handler. The associated function will be called when the user selects this particular menu item.
ParametersfunctionName:String — Name of the menu item event handler.
|
-- Create a new menu
menu = Menu:new("My menu")
-- Create a new menu item
menuItem = MenuItem:new("my menu item")
-- Set the menu item event handler
menuItem:setOnSelected("menuItem_selected")
-- This function will be called when the menu item is clicked:
function menuItem_selected(event)
dialogs:showMessage("'"..event.menuItem:getText().."' was clicked!")
end
| setTag | () | method |
public function setTag(tag:String):voidSets the tag property of the menu item. The menu item tag is user-defined and can be any string. It can be used to associate some additional data, such as the ID of an object, to the menu item.
Parameterstag:String — Menu item tag.
|
| setText | () | method |
public function setText(text:String):voidSets the text (label) property of the menu item.
Parameterstext:String — Menu item text.
|