Form
Form is to display the main window of the UI.
- Form
Properties
Property | Description |
---|---|
Width | The width of the Form. |
Height | The height of the Form. |
Fixed | Whether to fix the Form. |
Events
Callback Name | Callback Function |
---|---|
main_form_init | Called when gui.Loader:LoadForm is called. |
main_form_open | Called when the Form is open. |
main_form_close | Called when the Form is closed, after which the Form object is unloaded from memory. |
Lua Script Example
function main_form_init(self)
-- Set the form unfixed, so that it can be dragged
self.Fixed = false
end
function main_form_open(self)
local gui = nx_value("gui")
-- The gui global object can store the screen size, so the form can be set centered by virtue of this
self.Left = (gui.Width - self.Width) / 2
self.Top = (gui.Height - self.Height) / 2
end
function main_form_close(self)
nx_destroy(self)
end