Difference between revisions of "Lua:Class:Form"
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 …') |
|||
Line 46: | Line 46: | ||
'''form_setMenu'''(form, mainmenu) | '''form_setMenu'''(form, mainmenu) | ||
Sets a menu for the form | Sets a menu for the form | ||
+ | |||
+ | Example: | ||
+ | <pre> | ||
+ | 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. | ||
+ | form_hide(forms) -- hides the form | ||
+ | sleep(3000) | ||
+ | form_show(forms) -- again makes the form visible | ||
+ | sleep(3000) | ||
+ | form_centerScreen(forms) -- Places the form at the center of the screen | ||
+ | if form_isForegroundWindow(forms) then | ||
+ | print "form in focus" | ||
+ | end | ||
+ | form_onClose(forms, goodbyeMessage) -- delegates goodbyeMessage function. goodbyeMessage should have the prototype "goodbyeMessage(oneArgument)" | ||
+ | </pre> |
Revision as of 06:49, 14 April 2012
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
form_saveToFile(form, filename)
Saves a userdefined form. (DOES NOT WORK ON NORMAL FORMS LIKE MAINFORM)
form_centerScreen(form)
Places the form at the center of the screen
form_hide(form)
Hide the form
form_show(form)
Show the form
form_showModal(form)
Show the form and wait for it to close and get the close result
form_isForegroundWindow(form)
returns true if the specified form has focus
form_onClose(form, function)
function (sender) Return a CloseAction to determine how to close the window
form_getMenu(form)
Returns the mainmenu object of this form
form_setMenu(form, 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. form_hide(forms) -- hides the form sleep(3000) form_show(forms) -- again makes the form visible sleep(3000) form_centerScreen(forms) -- Places the form at the center of the screen if form_isForegroundWindow(forms) then print "form in focus" end form_onClose(forms, goodbyeMessage) -- delegates goodbyeMessage function. goodbyeMessage should have the prototype "goodbyeMessage(oneArgument)"