Updated Container docs
updated docs for container (child instead of object)
This commit is contained in:
@@ -4,14 +4,15 @@ In addition to the Object and VisualObject methods, container objects have the f
|
|||||||
|
|
||||||
| | |
|
| | |
|
||||||
|---|---|
|
|---|---|
|
||||||
|[addObject](objects/Container/addObject.md)|Adds a new object to the container
|
|[addChild](objects/Container/addChild.md)|Adds a new object to the container
|
||||||
|[getObject](objects/Container/getObject.md)|Returns an object in the container by its ID
|
|[getChild](objects/Container/getChild.md)|Returns an object in the container by its ID
|
||||||
|[getDeepObject](objects/Container/getDeepObject.md)|Returns an object in the container or its sub-containers by its ID
|
|[getDeepChild](objects/Container/getDeepChild.md)|Returns an object in the container or its sub-containers by its ID
|
||||||
|[removeObject](objects/Container/removeObject.md)|Removes an object from the container by its ID
|
|[removeChild](objects/Container/removeChild.md)|Removes an object from the container by its ID
|
||||||
|
|[removeChildren](objects/Container/removeChildren.md)|Removes all children object's
|
||||||
|[updateZIndex](objects/Container/updateZIndex.md)|Updates the Z-index of an object in the container
|
|[updateZIndex](objects/Container/updateZIndex.md)|Updates the Z-index of an object in the container
|
||||||
|[setImportant](objects/Container/setImportant.md)|Marks an object as important, so it is displayed on top if needed
|
|[setImportant](objects/Container/setImportant.md)|Marks an object as important, so it is displayed on top if needed
|
||||||
|[sortElementOrder](objects/Container/sortElementOrder.md)|Sorts the order of elements in the container based on their Z-indices
|
|[sortElementOrder](objects/Container/sortElementOrder.md)|Sorts the order of elements in the container based on their Z-indices
|
||||||
|[removeFocusedObject](objects/Container/removeFocusedObject.md)|Removes focus from an object in the container
|
|[clearFocusedChild](objects/Container/clearFocusedChild.md)|Removes focus from an object in the container
|
||||||
|[setFocusedObject](objects/Container/setFocusedObject.md)|Sets focus on a specific object in the container
|
|[setFocusedChild](objects/Container/setFocusedChild.md)|Sets focus on a specific object in the container
|
||||||
|
|
||||||
A Container Object inherits from VisualObject, but won't draw children objects.
|
A Container Object inherits from VisualObject, but won't draw children objects.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
## addObject
|
## addChild
|
||||||
|
|
||||||
### Description
|
### Description
|
||||||
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
## removeFocusedObject
|
## clearFocusedChild
|
||||||
|
|
||||||
### Description
|
### Description
|
||||||
|
|
||||||
Removes the focus from the currently focused object within the container. If no object is focused, this method has no effect.
|
Clears the focus from the currently focused object within the container. If no object is focused, this method has no effect.
|
||||||
|
|
||||||
### Returns
|
### Returns
|
||||||
|
|
||||||
@@ -18,13 +18,13 @@ local inputField1 = container:addInputField()
|
|||||||
local inputField2 = container:addInputField()
|
local inputField2 = container:addInputField()
|
||||||
:setPosition(2, 4)
|
:setPosition(2, 4)
|
||||||
|
|
||||||
container:setFocusedObject(inputField1)
|
container:setFocusedChild(inputField1)
|
||||||
|
|
||||||
main:addButton()
|
main:addButton()
|
||||||
:setPosition(2, 6)
|
:setPosition(2, 6)
|
||||||
:setText("Remove focus from input fields")
|
:setText("Remove focus from input fields")
|
||||||
:onClick(function()
|
:onClick(function()
|
||||||
container:removeFocusedObject()
|
container:clearFocusedChild()
|
||||||
basalt.debug("Focus removed from input fields!")
|
basalt.debug("Focus removed from input fields!")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
## getObject
|
## getChild
|
||||||
|
|
||||||
### Description
|
### Description
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ local button = main:addButton("myButton")
|
|||||||
:setText("My Button")
|
:setText("My Button")
|
||||||
|
|
||||||
-- Get the button object by its ID
|
-- Get the button object by its ID
|
||||||
local retrievedButton = main:getObject("myButton")
|
local retrievedButton = main:getChild("myButton")
|
||||||
if retrievedButton then
|
if retrievedButton then
|
||||||
basalt.debug("Button found!")
|
basalt.debug("Button found!")
|
||||||
end
|
end
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
## getDeepObject
|
## getDeepChild
|
||||||
|
|
||||||
### Description
|
### Description
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ local button = container:addButton("myButton")
|
|||||||
:setPosition(2, 2)
|
:setPosition(2, 2)
|
||||||
:setText("My Button")
|
:setText("My Button")
|
||||||
-- Get the button object by its ID, searching through all containers
|
-- Get the button object by its ID, searching through all containers
|
||||||
local retrievedButton = main:getDeepObject("myButton")
|
local retrievedButton = main:getDeepChild("myButton")
|
||||||
if retrievedButton then
|
if retrievedButton then
|
||||||
basalt.debug("Button found!")
|
basalt.debug("Button found!")
|
||||||
end
|
end
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
## removeObject
|
## removeChild
|
||||||
|
|
||||||
### Description
|
### Description
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ main:addButton()
|
|||||||
:setPosition(2, 4)
|
:setPosition(2, 4)
|
||||||
:setText("Remove the button above")
|
:setText("Remove the button above")
|
||||||
:onClick(function()
|
:onClick(function()
|
||||||
local removed = container:removeObject("removableButton")
|
local removed = container:removeChild("removableButton")
|
||||||
if removed then
|
if removed then
|
||||||
basalt.debug("Button removed!")
|
basalt.debug("Button removed!")
|
||||||
else
|
else
|
||||||
22
docs/objects/Container/removeChildren.md
Normal file
22
docs/objects/Container/removeChildren.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
## removeChildren
|
||||||
|
|
||||||
|
### Description
|
||||||
|
|
||||||
|
The `removeChildren` method allows you to remove all child objects from a parent container. This is helpful when you want to clear all elements within a container object, such as a frame, and start with a clean slate.
|
||||||
|
|
||||||
|
### Returns
|
||||||
|
|
||||||
|
1. `object` The object in use
|
||||||
|
|
||||||
|
### Usage
|
||||||
|
|
||||||
|
```lua
|
||||||
|
local mainFrame = basalt.createFrame()
|
||||||
|
|
||||||
|
-- Add some child objects to the frame
|
||||||
|
mainFrame:addLabel("label1", "Hello", 5, 5)
|
||||||
|
mainFrame:addButton("button1", "Click Me", 5, 10)
|
||||||
|
|
||||||
|
-- Remove all child objects from the frame
|
||||||
|
mainFrame:removeChildren()
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user