Module controls.object
Object module
Functions
Object:New (obj) | Object constructor |
Object:Dispose (_internal) | Disposes of the object. |
Object:SetParent (obj) | Sets the parent object |
Object:AddChild (obj) | Adds the child object |
Object:RemoveChild (child) | Removes the child object |
Object:ClearChildren () | Removes all children |
Object:IsEmpty () | Specifies whether the object has any visible children |
Object:HideChild (obj) | Hides a specific child |
Object:ShowChild (obj) | Makes a specific child visible |
Object:SetVisibility (visible) | Sets the visibility of the object |
Object:Hide () | Hides the objects |
Object:Show () | Makes the object visible |
Object:ToggleVisibility () | Toggles object visibility |
Object:GetChildByName (name) | Returns a child by name |
Object:GetObjectByName (name) | Resursive search to find an object by its name |
Tables
Object | Object fields. |
Functions
- Object:New (obj)
-
Object constructor
Parameters:
- obj Object the object table
- Object:Dispose (_internal)
-
Disposes of the object.
Calling this releases unmanaged resources like display lists and disposes of the object.
Children are disposed too.
TODO: use scream, in case the user forgets.
nil -> nil
Parameters:
- _internal
- Object:SetParent (obj)
-
Sets the parent object
Parameters:
- obj Object parent object
- Object:AddChild (obj)
-
Adds the child object
Parameters:
- obj Object child object to be added
- Object:RemoveChild (child)
-
Removes the child object
Parameters:
- child Object child object to be removed
- Object:ClearChildren ()
- Removes all children
- Object:IsEmpty ()
-
Specifies whether the object has any visible children
Returns:
-
bool
- Object:HideChild (obj)
-
Hides a specific child
Parameters:
- obj Object child to be hidden
- Object:ShowChild (obj)
-
Makes a specific child visible
Parameters:
- obj Object child to be made visible
- Object:SetVisibility (visible)
-
Sets the visibility of the object
Parameters:
- visible bool visibility status
- Object:Hide ()
- Hides the objects
- Object:Show ()
- Makes the object visible
- Object:ToggleVisibility ()
- Toggles object visibility
- Object:GetChildByName (name)
-
Returns a child by name
Parameters:
- name string child name
Returns:
-
Object
child
- Object:GetObjectByName (name)
-
Resursive search to find an object by its name
Parameters:
- name string name of the object
Returns:
Tables
- Object
-
Object fields.
Fields:
- visible bool control is displayed (default true)
- children {Object1,Object2,...} table of visible children objects (default {})
- children_hidden {Object1,Object2,...} table of invisible children objects (default {})
- childrenByName {"obj1Name"=Object1,"obj2Name"=Object2,...} table mapping name->child
- OnDispose {func1,func2,...} function listeners for object disposal, (default {})
- OnClick {func1,func2,...} function listeners for mouse click, (default {})
- OnDblClick {func1,func2,...} function listeners for mouse double click, (default {})
- OnMouseDown {func1,func2,...} function listeners for mouse press, (default {})
- OnMouseUp {func1,func2,...} function listeners for mouse release, (default {})
- OnMouseMove {func1,func2,...} function listeners for mouse movement, (default {})
- OnMouseWheel {func1,func2,...} function listeners for mouse scrolling, (default {})
- OnMouseOver {func1,func2,...} function listeners for mouse over...?, (default {})
- OnMouseOut {func1,func2,...} function listeners for mouse leaving the object, (default {})
- OnKeyPress {func1,func2,...} function listeners for key press, (default {})
- OnFocusUpdate {func1,func2,...} function listeners for focus change, (default {})
- disableChildrenHitTest bool if set childrens are not clickable/draggable etc - their mouse events are not processed (default false)