Difference between revisions of "Lua:Class:Menu"

From Cheat Engine
Jump to navigation Jump to search
(Related Functions)
m
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Menu '''class''': ('''Inheritance''': ''[[Component]]''->''[[Object]]'')
+
[[Category:Lua]]
 +
{{Class|'''class''' Menu ''':''' Component}}
  
Class for menu objects used in [[Form]]s.
+
The Menu class represents a menu component.
  
== Properties ==
+
A Menu inherits from Component and Object. It provides access to the root MenuItem object through the Items property or the getItems() method.
; Items : MenuItem : ''Readonly''
 
: The base [[MenuItem]] class of this Menu.
 
  
== Methods ==
+
===Inheritance===
; getItems() : MenuItem
+
{|width="85%" cellpadding="10%" cellspacing="0" border="0"
: Returns the main [[MenuItem]] of this Menu.
+
!align="left"|Class
 +
!align="left"|Inherits From
 +
!style="width: 80%;background-color:white;" align="left"|Description
 +
|-
 +
|Menu
 +
|Component
 +
|A menu component that provides access to its root MenuItem.
 +
|-
 +
|Component
 +
|Object
 +
|Base class for components.
 +
|}
  
== See also ==
+
===Properties===
* [[Lua]]
+
{|width="85%" cellpadding="10%" cellspacing="0" border="0"
* [[Help_File:Script engine|Script engine]]
+
!align="left"|Property
 +
!align="left"|Type
 +
!style="width: 80%;background-color:white;" align="left"|Description
 +
|-
 +
|Items
 +
|MenuItem
 +
|The base MenuItem object of this menu. This property is read-only.
 +
|}
  
=== Related Functions ===
+
===Methods===
* [[createMainMenu]]
+
{|width="85%" cellpadding="10%" cellspacing="0" border="0"
* [[createMenuItem]]
+
!align="left"|Method
* [[createPopupMenu]]
+
!align="left"|Return Type
 +
!style="width: 80%;background-color:white;" align="left"|Description
 +
|-
 +
|getItems()
 +
|MenuItem
 +
|Returns the main MenuItem object of this menu.
 +
|}
  
=== Related Classes ===
+
===Examples===
* [[MenuItem]]
+
<pre>
* [[MainMenu]]
+
local form = createForm()
* [[PopupMenu]]
+
local menu = createMainMenu(form)
* [[Form]]
+
 
* [[Control]]
+
form.Menu = menu
* [[Component]]
+
 
* [[WinControl]]
+
local root = menu.Items
 +
 
 +
local fileItem = createMenuItem(menu)
 +
fileItem.Caption = "File"
 +
root.add(fileItem)
 +
 
 +
form.show()
 +
</pre>
 +
 
 +
<pre>
 +
local form = createForm()
 +
local menu = createMainMenu(form)
 +
 
 +
form.Menu = menu
 +
 
 +
local root = menu.getItems()
 +
 
 +
local item = createMenuItem(menu)
 +
item.Caption = "Example"
 +
 
 +
root.add(item)
 +
 
 +
form.show()
 +
</pre>
 +
 
 +
{{LuaSeeAlso}}
 +
 
 +
{{Forms}}

Latest revision as of 00:28, 25 June 2026

{} Class

class Menu : Component

The Menu class represents a menu component.

A Menu inherits from Component and Object. It provides access to the root MenuItem object through the Items property or the getItems() method.

Inheritance[edit]

Class Inherits From Description
Menu Component A menu component that provides access to its root MenuItem.
Component Object Base class for components.

Properties[edit]

Property Type Description
Items MenuItem The base MenuItem object of this menu. This property is read-only.

Methods[edit]

Method Return Type Description
getItems() MenuItem Returns the main MenuItem object of this menu.

Examples[edit]

local form = createForm()
local menu = createMainMenu(form)

form.Menu = menu

local root = menu.Items

local fileItem = createMenuItem(menu)
fileItem.Caption = "File"
root.add(fileItem)

form.show()
local form = createForm()
local menu = createMainMenu(form)

form.Menu = menu

local root = menu.getItems()

local item = createMenuItem(menu)
item.Caption = "Example"

root.add(item)

form.show()

Main Pages

Core Lua documentation entry points

Lua
Script Engine

Form Related Classes