Lua:Class:CEForm

From Cheat Engine
Revision as of 19:38, 23 June 2026 by Leunsel (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

{} Class

class CEForm : Form

The CEForm class represents a Cheat Engine form window.

A CEForm inherits from Form, ScrollingWinControl, CustomControl, WinControl, Control, Component, and Object. It can be created directly or loaded from a file or stream.

Inheritance[edit]

Class Inherits From Description
CEForm Form A Cheat Engine form window.
Form ScrollingWinControl Base class for form windows.
ScrollingWinControl CustomControl Base class for controls that can contain scrollable child controls.
CustomControl WinControl Base class for custom windowed controls.
WinControl Control Base class for windowed controls.
Control Component Base class for visual controls.
Component Object Base class for components.

Creation[edit]

<> Reference

function createForm(visible) : CEForm

<> Reference

function createFormFromFile(filename) : CEForm

<> Reference

function createFormFromStream(stream) : CEForm

Creates or loads a CEForm object.

createForm creates a new CEForm window. The visible parameter is optional and defaults to true.

createFormFromFile loads a form from a file and returns the generated CEForm.

createFormFromStream loads a form from a stream and returns the generated CEForm.

Function Parameters[edit]

Function Parameter Description
createForm(visible) visible: Boolean (optional) If true, the form is visible after creation. Defaults to true.
createFormFromFile(filename) filename: String The path to the form file to load.
createFormFromStream(stream) stream: Stream The stream to load the form from.

Returns[edit]

CEForm — The created or loaded CEForm object.

Properties[edit]

Property Type Description
DoNotSaveInTable Boolean Set this to true if the form should not be saved in the table.

Methods[edit]

Method Return Type Description
saveToFile(filename) void Saves the user-defined form to a file.
saveToStream(s) void Saves the user-defined form to the given stream.
getDoNotSaveInTable() Boolean Returns the DoNotSaveInTable property.
setDoNotSaveInTable(boolean) void Sets the DoNotSaveInTable property.
saveCurrentStateAsDesign() void Sets the current state of the form as the design state that will be saved when the table is saved.

Examples[edit]

local form = createForm(false)

form.Caption = "CEForm Example"
form.Width = 400
form.Height = 250
form.centerScreen()

form.show()
local form = createForm()
form.Caption = "Do Not Save Example"

form.DoNotSaveInTable = true

print("DoNotSaveInTable: " .. tostring(form.DoNotSaveInTable))
local form = createForm()
form.Caption = "Save Form Example"
form.Width = 400
form.Height = 250

form.saveCurrentStateAsDesign()
form.saveToFile("C:\\\\Temp\\\\example_form.frm")
local form = createFormFromFile("C:\\\\Temp\\\\example_form.frm")

if form ~= nil then
  form.Caption = "Loaded Form"
  form.show()
end
local stream = createMemoryStream()

local form = createForm()
form.Caption = "Stream Save Example"

form.saveToStream(stream)

stream.Position = 0

local loadedForm = createFormFromStream(stream)

if loadedForm ~= nil then
  loadedForm.Caption = "Loaded From Stream"
  loadedForm.show()
end

stream.destroy()

See Also[edit]

Main Pages