Difference between revisions of "Lua:Class:Form"

From Cheat Engine
Jump to navigation Jump to search
(Created page with ''''Form Class''' (Inheritance ScrollingWinControl->CustomControl->WinControl->Control->Component->Object) The Form class is a window '''createForm'''(visible OPT) Creates …')
 
m (Reverted edits by This content is not available (Talk) to last revision by TheyCallMeTim13)
 
(9 intermediate revisions by 4 users not shown)
Line 1: Line 1:
'''Form Class''' (Inheritance ScrollingWinControl->CustomControl->WinControl->Control->Component->Object)
+
[[Category:Lua]]
  The Form class is a window
+
'''Form Class''' (Inheritance ''[[Lua:Class:ScrollingWinControl|ScrollingWinControl]]''->''[[Lua:Class:CustomControl|CustomControl]]''->''[[Lua:Class:WinControl|WinControl]]''->''[[Lua:Class:Control|Control]]''->''[[Lua:Class:Component|Component]]''->''[[Lua:Class:Object|Object]]'')
  
 +
The Form class is a window
  
 
'''createForm'''(visible OPT)  
 
'''createForm'''(visible OPT)  
  Creates a Form class object(window) and returns the pointer for it. Visible is default true but can be changed
+
Creates a Form class object(window) and returns the pointer for it. Visible is default true but can be changed
 
 
  
 
'''createFormFromFile'''(filename)  
 
'''createFormFromFile'''(filename)  
  Creates a Form class object and initializes it based on the data in the given file.
+
Creates a Form class object and initializes it based on the data in the given file.
  It returns the generated form
+
It returns the generated form
 
 
  
'''form_saveToFile'''(form, filename)
 
  Saves a userdefined form. (DOES NOT WORK ON NORMAL FORMS LIKE MAINFORM)
 
  
 +
== Properties ==
  
'''form_centerScreen'''(form)
 
  Places the form at the center of the screen
 
  
 +
== Methods ==
 +
'''saveToFile'''(filename)
 +
Saves a userdefined form. (DOES NOT WORK ON NORMAL FORMS LIKE MAINFORM)
  
'''form_hide'''(form)
+
'''centerScreen'''()
  Hide the form
+
Places the form at the center of the screen
  
 +
'''hide'''()
 +
Hide the form
  
'''form_show'''(form)
+
'''show'''()
  Show the form
+
Show the form
  
 +
'''showModal'''()
 +
Show the form and wait for it to close and get the close result
  
'''form_showModal'''(form)  
+
'''isForegroundWindow'''()  
  Show the form and wait for it to close and get the close result
+
returns true if the specified form has focus
  
 +
'''onClose'''(function)
 +
function (sender) Return a CloseAction to determine how to close the window
  
'''form_isForegroundWindow'''(form)  
+
'''getMenu'''(form)
  returns true if the specified form has focus
+
Returns the mainmenu object of this form
  
 +
'''setMenu'''(mainmenu)
 +
Sets a menu for the form
  
'''form_onClose'''(form, function) 
 
  function (sender)  Return a CloseAction to determine how to close the window
 
  
 +
== Examples ==
 +
<pre>
 +
function goodbyeMessage(sender)
 +
  print "called by form_onClose"
 +
  closeCE()                    -- Just closes ce
 +
end
  
'''form_getMenu'''(form)   
+
local forms = createForm(true) -- true = visible(optional), false = not visible when created.
   Returns the mainmenu object of this form
+
forms.hide()              -- hides the form
 +
sleep(3000)
 +
forms.show()                -- again makes the form visible
 +
sleep(3000)
 +
forms.centerScreen()      -- Places the form at the center of the screen
 +
if forms.isForegroundWindow(formsthen
 +
   print "form in focus"
 +
end
 +
forms.onClose(goodbyeMessage)  -- delegates goodbyeMessage function. goodbyeMessage should have the prototype "goodbyeMessage(oneArgument)"
 +
</pre>
  
  
'''form_setMenu'''(form, mainmenu)
+
{{LuaSeeAlso}}
  Sets a menu for the form
 

Latest revision as of 19:07, 18 March 2019

Form Class (Inheritance ScrollingWinControl->CustomControl->WinControl->Control->Component->Object)

The Form class is a window

createForm(visible OPT) Creates a Form class object(window) and returns the pointer for it. Visible is default true but can be changed

createFormFromFile(filename) Creates a Form class object and initializes it based on the data in the given file. It returns the generated form


Properties[edit]

Methods[edit]

saveToFile(filename) Saves a userdefined form. (DOES NOT WORK ON NORMAL FORMS LIKE MAINFORM)

centerScreen() Places the form at the center of the screen

hide() Hide the form

show() Show the form

showModal() Show the form and wait for it to close and get the close result

isForegroundWindow() returns true if the specified form has focus

onClose(function) function (sender) Return a CloseAction to determine how to close the window

getMenu(form) Returns the mainmenu object of this form

setMenu(mainmenu) Sets a menu for the form


Examples[edit]

function goodbyeMessage(sender)
  print "called by form_onClose"
  closeCE()                    -- Just closes ce
end

local forms = createForm(true) -- true = visible(optional), false = not visible when created.
forms.hide()               -- hides the form
sleep(3000)
forms.show()                -- again makes the form visible
sleep(3000)
forms.centerScreen()       -- Places the form at the center of the screen
if forms.isForegroundWindow(forms)  then
  print "form in focus"
end
forms.onClose(goodbyeMessage)   -- delegates goodbyeMessage function. goodbyeMessage should have the prototype "goodbyeMessage(oneArgument)"


See also[edit]