Difference between revisions of "Lua:Class:Control"

From Cheat Engine
Jump to navigation Jump to search
(Undo revision 5662 by TheyCallMeTim13 (Talk))
 
(14 intermediate revisions by 3 users not shown)
Line 1: Line 1:
'''Control Class''' (Inheritance Component->Object)
+
[[Category:Lua]]
'''control_setCaption'''(control, caption)
+
Control '''class''': ('''Inheritance''': ''[[Lua:Class:Component|Component]]''->''[[Lua:Class:Object|Object]]'')
  Sets the text on a control. All the gui objects fall in this category
 
  
 +
Base class for gui controls.
  
'''control_getCaption'''(control) 
+
== Properties ==
  Returns the text of the control
 
  
 +
; Caption : string
 +
: The text of a control.
  
'''control_setPosition'''(control, x,y)
+
; Top : integer
  Sets the x and y position of the object base don the top left position (relative to the client array of the owner object)
+
: The x position.
  
 +
; Left : integer
 +
: The y position.
  
'''control_getPosition'''(contron)
+
; Width : integer
  Returns the x and y position of the object (relative to the client array of the owner object)
+
: The width of the control.
  
 +
; Height : integer
 +
: The height of the control.
  
'''control_setSize'''(control, width,height) 
+
; ClientWidth : integer
  Sets the width and height of the control
+
: The usable width inside the control (minus the borders).
  
 +
; ClientHeight : integer
 +
: The usable height the control (minus the borders).
  
'''control_getSize'''(control) 
+
; Align : AlignmentOption
  Sets the size of the control
+
: Alignment of the control.
  
 +
; Enabled : boolean
 +
: Determines if the object is usable or greyed out.
  
'''control_setAlign'''(control, alignmentoption)
+
; Visible : boolean
  Sets the alignment of the control
+
: Determines if the object is visible or not.
  
 +
; Color : ColorDefinition/RGBInteger
 +
: The color of the object. Does not affect the caption.
  
'''control_getAlign'''(control, alignmentoption)
+
; Parent : WinControl
  Gets the alignment of the control
+
: The owner of this control.
  
 +
; PopupMenu : PopupMenu
 +
: The popup menu that shows when rightclicking the control.
  
'''control_getEnabled'''(control) 
+
; Font : Font
  Gets the enabled state of the control
+
: The font class associated with the control.
  
 +
; OnClick : function
 +
: The function to call when a button is pressed.
  
'''control_setEnabled'''(control, boolean) 
+
== Methods ==
  Sets the enabled state of the control
 
  
 +
; getLeft() : integer
 +
: Returns the left position.
  
'''control_getVisible'''(control)  
+
; setLeft(''value'')
  Gets the visible state of the control
+
: Sets the left position.
  
 +
; getTop() : integer
 +
: Returns the top position.
  
'''control_setVisible'''(control, boolean)  
+
; setTop(''value'')
  Sets the visible state of the control
+
: Sets the top position.
  
 +
; getWidth() : integer
 +
: Returns the width.
  
'''control_getColor'''(control)  
+
; setWidth(''value'')
  Gets the color
+
: Sets the width.
  
 +
; getHeight() : integer
 +
: Returns the height.
  
'''control_setColor'''(control, rgb)  
+
; setHeight()
  Sets the color
+
: Sets the height.
  
 +
; setCaption(''caption'')
 +
: Sets the text on a control. All the gui objects fall in this category.
  
'''control_getParent'''(control)  
+
; getCaption() : string
  Returns nil or an object that inherits from the Wincontrol class
+
: Returns the text of the control
  
 +
; setPosition(''x'', ''y'')
 +
: Sets the x and y position of the object base don the top left position (relative to the client array of the owner object)
  
'''control_setParent'''(control)  
+
; getPosition() : (integer, integer)
  Sets the parent for this control
+
: Returns the x and y position of the object (relative to the client array of the owner object)
  
 +
; setSize(''width'', ''height'')
 +
: Sets the width and height of the control
  
'''control_getPopupMenu'''(control)
+
; getSize() : (integer, integer)
  Gets the assigned popup menu to this control
+
: Gets the size of the control
  
 +
; setAlign(''alignmentOption'')
 +
: sets the alignment of the control.
  
'''control_setPopupMenu('''control)
+
; getAlign(''alignmentOption'')
  Sets the popup menu for this control
+
: gets the alignment of the control.
  
 +
; getEnabled() : boolean
 +
: gets the enabled state of the control.
  
'''control_onClick'''(control, functionnameorstring)
+
; setEnabled(''state'')
  Sets the onclick routine
+
: Sets the enabled state of the control.
  function (sender)
 
  
<pre>
+
; getVisible() &#58; boolean
--Example:
+
: gets the visible state of the control.
local forms = createForm()
 
local labels = createLabel(forms)
 
  
--Caption
+
; setVisible(''state'')
control_setCaption(labels, "My first label")
+
: sets the visible state of the control.
local variable = control_getCaption(labels)
 
print(variable)
 
  
--Position
+
; getColor() &#58; integer
control_setPosition(labels,30,30)
+
: gets the color.
x,y=control_getPosition(labels)
 
print("X coord of label is "..x.."; Y coord of label is "..y)
 
  
--Enabled?
+
; setColor(''rgb'')
local editbox1 = createEdit(forms)
+
: Sets the color.
local editbox2 = createEdit(forms)
 
control_setEnabled(editbox1,false)
 
if control_getEnabled(editbox1) then
 
  
  else
+
; getParent() &#58; WinControl
  print "editbox1 not enabled"
+
: Returns nil or an object that inherits from the [[WinControl]] class.
  control_setCaption(editbox1,"editbox1")
 
end
 
  
control_setEnabled(editbox2,true)
+
; setParent(''winControl'')
  if control_getEnabled(editbox2) then
+
: Sets the parent for this control.
  print "editbox2  enabled"
 
  control_setCaption(editbox2,"editbox2")
 
end
 
  
control_setPosition(editbox1,30,60)
+
; getPopupMenu() &#58; Menu
control_setPosition(editbox2,30,90)
+
: Returns the pop up menu.
</pre>
+
 
 +
; setPopupMenu()
 +
: Sets the pop up menu.
 +
 
 +
; getFont() &#58; Font
 +
: Returns the Font object of this object.
 +
 
 +
; setFont()
 +
: Assigns a new font object. (Not recommended to use. Change the font object that's already there if you wish to change fonts).
 +
 
 +
; repaint()
 +
: Invalidates the graphical area of the control and forces and update.
 +
 
 +
; update()
 +
: Only updates the invalidated areas.
 +
 
 +
; setOnClick(''functionNameOrString'')
 +
: Sets the onclick routine.
 +
 
 +
; getOnClick() &#58; function
 +
: Gets the onclick function.
 +
 
 +
; doClick()
 +
: Executes the current function under onClick.
 +
 
 +
{{LuaSeeAlso}}
 +
 
 +
=== Related Functions ===
 +
* [[Lua:createClass|createClass]]
 +
* [[Lua:inheritsFromObject|inheritsFromObject]]
 +
* [[Lua:inheritsFromComponent|inheritsFromComponent]]
 +
* [[Lua:inheritsFromControl|inheritsFromControl]]
 +
* [[Lua:inheritsFromWinControl|inheritsFromWinControl]]
 +
 
 +
=== Related Classes ===
 +
* [[Lua:Class:Object|Object]]
 +
* [[Lua:Class:Control|Control]]
 +
* [[Lua:Class:WinControl|WinControl]]
 +
* [[Lua:Class:Application|Application]]
 +
* [[Lua:Class:Form|Form]]

Latest revision as of 20:55, 24 January 2018

Control class: (Inheritance: Component->Object)

Base class for gui controls.

Properties[edit]

Caption : string
The text of a control.
Top : integer
The x position.
Left : integer
The y position.
Width : integer
The width of the control.
Height : integer
The height of the control.
ClientWidth : integer
The usable width inside the control (minus the borders).
ClientHeight : integer
The usable height the control (minus the borders).
Align : AlignmentOption
Alignment of the control.
Enabled : boolean
Determines if the object is usable or greyed out.
Visible : boolean
Determines if the object is visible or not.
Color : ColorDefinition/RGBInteger
The color of the object. Does not affect the caption.
Parent : WinControl
The owner of this control.
PopupMenu : PopupMenu
The popup menu that shows when rightclicking the control.
Font : Font
The font class associated with the control.
OnClick : function
The function to call when a button is pressed.

Methods[edit]

getLeft() : integer
Returns the left position.
setLeft(value)
Sets the left position.
getTop() : integer
Returns the top position.
setTop(value)
Sets the top position.
getWidth() : integer
Returns the width.
setWidth(value)
Sets the width.
getHeight() : integer
Returns the height.
setHeight()
Sets the height.
setCaption(caption)
Sets the text on a control. All the gui objects fall in this category.
getCaption() : string
Returns the text of the control
setPosition(x, y)
Sets the x and y position of the object base don the top left position (relative to the client array of the owner object)
getPosition() : (integer, integer)
Returns the x and y position of the object (relative to the client array of the owner object)
setSize(width, height)
Sets the width and height of the control
getSize() : (integer, integer)
Gets the size of the control
setAlign(alignmentOption)
sets the alignment of the control.
getAlign(alignmentOption)
gets the alignment of the control.
getEnabled() : boolean
gets the enabled state of the control.
setEnabled(state)
Sets the enabled state of the control.
getVisible() : boolean
gets the visible state of the control.
setVisible(state)
sets the visible state of the control.
getColor() : integer
gets the color.
setColor(rgb)
Sets the color.
getParent() : WinControl
Returns nil or an object that inherits from the WinControl class.
setParent(winControl)
Sets the parent for this control.
getPopupMenu() : Menu
Returns the pop up menu.
setPopupMenu()
Sets the pop up menu.
getFont() : Font
Returns the Font object of this object.
setFont()
Assigns a new font object. (Not recommended to use. Change the font object that's already there if you wish to change fonts).
repaint()
Invalidates the graphical area of the control and forces and update.
update()
Only updates the invalidated areas.
setOnClick(functionNameOrString)
Sets the onclick routine.
getOnClick() : function
Gets the onclick function.
doClick()
Executes the current function under onClick.

See also[edit]

Related Functions[edit]

Related Classes[edit]