Difference between revisions of "Lua:Class:Form"
Jump to navigation
Jump to search
Line 11: | Line 11: | ||
It returns the generated form | It returns the generated form | ||
+ | == Properties == | ||
− | ''' | + | |
+ | == Methods == | ||
+ | |||
+ | |||
+ | '''saveToFile'''(filename) | ||
Saves a userdefined form. (DOES NOT WORK ON NORMAL FORMS LIKE MAINFORM) | Saves a userdefined form. (DOES NOT WORK ON NORMAL FORMS LIKE MAINFORM) | ||
− | ''' | + | '''centerScreen'''() |
Places the form at the center of the screen | Places the form at the center of the screen | ||
− | ''' | + | '''hide'''() |
Hide the form | Hide the form | ||
− | ''' | + | '''show'''() |
Show the form | Show the form | ||
− | ''' | + | '''showModal'''() |
Show the form and wait for it to close and get the close result | Show the form and wait for it to close and get the close result | ||
− | ''' | + | '''isForegroundWindow'''() |
returns true if the specified form has focus | returns true if the specified form has focus | ||
− | ''' | + | '''onClose'''(function) |
function (sender) Return a CloseAction to determine how to close the window | function (sender) Return a CloseAction to determine how to close the window | ||
− | ''' | + | '''getMenu'''(form) |
Returns the mainmenu object of this form | Returns the mainmenu object of this form | ||
− | ''' | + | '''setMenu'''(mainmenu) |
Sets a menu for the form | Sets a menu for the form | ||
Line 55: | Line 60: | ||
local forms = createForm(true) -- true = visible(optional), false = not visible when created. | local forms = createForm(true) -- true = visible(optional), false = not visible when created. | ||
− | + | forms.hide() -- hides the form | |
sleep(3000) | sleep(3000) | ||
− | + | forms.show() -- again makes the form visible | |
sleep(3000) | sleep(3000) | ||
− | + | forms.centerScreen() -- Places the form at the center of the screen | |
− | if | + | if forms.isForegroundWindow(forms) then |
print "form in focus" | print "form in focus" | ||
end | end | ||
− | + | forms.onClose(goodbyeMessage) -- delegates goodbyeMessage function. goodbyeMessage should have the prototype "goodbyeMessage(oneArgument)" | |
</pre> | </pre> |
Revision as of 23:45, 17 January 2017
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
Methods
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
Example:
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)"