Skip to main content

Form

Form is to display the main window of the UI.

  • Form

form

Properties

PropertyDescription
WidthThe width of the Form.
HeightThe height of the Form.
FixedWhether to fix the Form.

Events

addCallBack1

Callback NameCallback Function
main_form_initCalled when gui.Loader:LoadForm is called.
main_form_openCalled when the Form is open.
main_form_closeCalled 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