Lua:Class:MenuItem
Jump to navigation
Jump to search
MenuItem Class: (Inheritance: Component->Object)
A clickable part of a menu
createMenuItem(ownermenu) : Creates a menu item that gets added to the owner menu
Properties
Caption : String - Text of the menu item Shortcut : string - Shortcut in textform to trigger the menuitem Count : integer - Number of children attached to this menuitem Menu: Menu - The menu this item resides in Parent: MenuItem - The menuitem this item hangs under Item[] : Array to access each child menuitem [] : Item[] OnClick: Function to call when the menu item is activated
Methods
getCaption() : Gets the caption of the menu item setCaption(caption) : Sets the caption of the menu item getShortcut(): Returns the shortcut for this menu item setShortcut(shortcut): Sets the shortcut for this menuitem. A shortcut is a string in the form of ("ctrl+x") getCount() getItem(index) : Returns the menuitem object at the given index add(menuitem) : Adds a menuItem as a submenu item insert(index, menuitem): Adds a menuItem as a submenu item at the given index delete(index) setOnClick(function) : Sets an onClick event getOnClick() doClick(): Executes the onClick method if one is assigned