Lua:getMainForm
Jump to navigation
Jump to search
Returns the main Cheat Engine form object.
The returned object can be accessed using Form class properties and methods, as well as the properties and methods inherited from its parent classes.
Contents
Function Parameters[edit]
This function has no parameters.
Returns[edit]
Form — The main Cheat Engine form object.
Examples[edit]
Get the main form[edit]
1 local mainForm = getMainForm()
2
3 print(mainForm.Caption)
Change the main form caption[edit]
1 local mainForm = getMainForm()
2
3 mainForm.Caption = "Cheat Engine - Custom Caption"
Read the main form size[edit]
1 local mainForm = getMainForm()
2
3 print("Width : " .. tostring(mainForm.Width))
4 print("Height: " .. tostring(mainForm.Height))
Move the main form[edit]
1 local mainForm = getMainForm()
2
3 mainForm.Left = 100
4 mainForm.Top = 100
Center the main form on screen[edit]
1 local mainForm = getMainForm()
2
3 mainForm.Position = "poScreenCenter"
[edit]
1 local mainForm = getMainForm()
2
3 print(mainForm.Menu)
Hide and show the main form[edit]
1 local mainForm = getMainForm()
2
3 mainForm.hide()
4 sleep(1000)
5 mainForm.show()
Create a button on the main form[edit]
1 local mainForm = getMainForm()
2 local button = createButton(mainForm)
3
4 button.Caption = "Click Me"
5 button.Left = 10
6 button.Top = 10
7 button.Width = 100
8 button.OnClick = function()
9 showMessage("Button clicked")
10 end
Use inherited Control properties[edit]
1 local mainForm = getMainForm()
2
3 print("Visible: " .. tostring(mainForm.Visible))
4 print("Enabled: " .. tostring(mainForm.Enabled))