Difference between revisions of "Lua:Class:MenuItem"

From Cheat Engine
Jump to navigation Jump to search
(Created page with ''''MenuItem Class''': (Inheritance: Component->Object) A clickable part of a menu createMenuItem(ownermenu) : Creates a menu item that gets added to the owner menu …')
 
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''MenuItem Class''': (Inheritance: [[Component]]->[[Object]])
+
[[Category:Lua]]
 +
MenuItem '''class''': ('''Inheritance''': ''[[Lua:Class:Component|Component]]''->''[[Lua:Class:Object|Object]]'')
  
A clickable part of a menu
+
A clickable part of a menu.
  
  createMenuItem(ownermenu) : Creates a menu item that gets added to the owner menu
+
== Creation ==
 +
:; [[Lua:createMenuItem|createMenuItem]]() : MenuItem
 +
:: Creates an empty region.
  
 +
== Properties ==
 +
; DoubleBuffered : boolean
 +
: Graphical updates will go to a off screen bitmap which will then be shown on the screen instead of directly to the screen.
 +
: May reduce flickering.
  
===Properties===
+
; ControlCount : integer
  Caption : String - Text of the menu item
+
: The number of child controls of this [[Lua:Class:WinControl|WinControl]].
  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===
+
; Control[''index''] : Control
  getCaption() : Gets the caption of the menu item
+
: Array to access a child [[Lua:Class:Control|Control]].
  setCaption(caption) : Sets the caption of the menu item
+
 
  getShortcut(): Returns the shortcut for this menu item
+
; OnEnter : function
  setShortcut(shortcut): Sets the shortcut for this menuitem. A shortcut is a string in the form of ("ctrl+x")
+
: Function to be called when the [[Lua:Class:WinControl|WinControl]] gains focus.
  getCount()
+
 
  getItem(index) : Returns the menuitem object at the given index
+
; OnExit : function
  add(menuitem) : Adds a menuItem as a submenu item
+
: Function to be called when the [[Lua:Class:WinControl|WinControl]] loses focus.
  insert(index, menuitem): Adds a menuItem as a submenu item at the given index
+
 
  delete(index)
+
== Methods ==
  setOnClick(function) : Sets an onClick event
+
; getControlCount() : integer
  getOnClick()
+
: Returns the number of [[Lua:Class:Control|Control]]s attached to this class.
  doClick(): Executes the onClick method if one is assigned
+
 
 +
; getControl(''index'') : WinControl
 +
: Returns a [[Lua:Class:WinControl|WinControl]] class object.
 +
 
 +
; getControlAtPos(''x'', ''y'') : Control
 +
: Gets the [[Lua:Class:Control|Control]] at the given x,y position relative to the [[Lua:Class:WinControl|WinControl]]'s position.
 +
 
 +
; canFocus() : boolean
 +
: returns true if the object can be focused.
 +
 
 +
; focused() : boolean
 +
: returns boolean true when focused.
 +
 
 +
; setFocus()
 +
: tries to set keyboard focus the object.
 +
 
 +
; setShape(''region'')
 +
: Sets the region object as the new shape for this [[Lua:Class:WinControl|WinControl]].
 +
 
 +
; setShape(''bitmap'')
 +
: Sets the Bitmap object as the new shape for this [[Lua:Class:WinControl|WinControl]].
 +
 
 +
; setOnEnter(''function'')
 +
: Sets an onEnter event. (Triggered on focus enter)
 +
 
 +
; getOnEnter() : function
 +
: Returns the onEnter event. (Triggered on focus enter)
 +
 
 +
; setOnExit(''function'')
 +
: Sets an onExit event. (Triggered on lost focus)
 +
 
 +
; getOnExit() : function
 +
: Returns the onExit event. (Triggered on lost focus)
 +
 
 +
{{LuaSeeAlso}}
 +
 
 +
=== Related Functions ===
 +
* [[Lua:createMainMenu|createMainMenu]]
 +
* [[Lua:createMenuItem|createMenuItem]]
 +
* [[Lua:createPopupMenu|createPopupMenu]]
 +
 
 +
=== Related Classes ===
 +
* [[Lua:Class:Menu|Menu]]
 +
* [[Lua:Class:MenuItem|MenuItem]]
 +
* [[Lua:Class:PopupMenu|PopupMenu]]
 +
* [[Lua:Class:Form|Form]]
 +
* [[Lua:Class:Control|Control]]
 +
* [[Lua:Class:Component|Component]]
 +
* [[Lua:Class:WinControl|WinControl]]

Latest revision as of 02:04, 25 January 2018

MenuItem class: (Inheritance: Component->Object)

A clickable part of a menu.

Creation[edit]

createMenuItem() : MenuItem
Creates an empty region.

Properties[edit]

DoubleBuffered : boolean
Graphical updates will go to a off screen bitmap which will then be shown on the screen instead of directly to the screen.
May reduce flickering.
ControlCount : integer
The number of child controls of this WinControl.
Control[index] : Control
Array to access a child Control.
OnEnter : function
Function to be called when the WinControl gains focus.
OnExit : function
Function to be called when the WinControl loses focus.

Methods[edit]

getControlCount() : integer
Returns the number of Controls attached to this class.
getControl(index) : WinControl
Returns a WinControl class object.
getControlAtPos(x, y) : Control
Gets the Control at the given x,y position relative to the WinControl's position.
canFocus() : boolean
returns true if the object can be focused.
focused() : boolean
returns boolean true when focused.
setFocus()
tries to set keyboard focus the object.
setShape(region)
Sets the region object as the new shape for this WinControl.
setShape(bitmap)
Sets the Bitmap object as the new shape for this WinControl.
setOnEnter(function)
Sets an onEnter event. (Triggered on focus enter)
getOnEnter() : function
Returns the onEnter event. (Triggered on focus enter)
setOnExit(function)
Sets an onExit event. (Triggered on lost focus)
getOnExit() : function
Returns the onExit event. (Triggered on lost focus)

See also[edit]

Related Functions[edit]

Related Classes[edit]