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
|
||||
|[getObject](objects/Container/getObject.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
|
||||
|[removeObject](objects/Container/removeObject.md)|Removes an object from the container by its ID
|
||||
|[addChild](objects/Container/addChild.md)|Adds a new object to the container
|
||||
|[getChild](objects/Container/getChild.md)|Returns an object in the container by its ID
|
||||
|[getDeepChild](objects/Container/getDeepChild.md)|Returns an object in the container or its sub-containers 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
|
||||
|[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
|
||||
|[removeFocusedObject](objects/Container/removeFocusedObject.md)|Removes focus from an object in the container
|
||||
|[setFocusedObject](objects/Container/setFocusedObject.md)|Sets focus on a specific object in the container
|
||||
|[clearFocusedChild](objects/Container/clearFocusedChild.md)|Removes focus from an 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.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## addObject
|
||||
## addChild
|
||||
|
||||
### Description
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
## removeFocusedObject
|
||||
## clearFocusedChild
|
||||
|
||||
### 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
|
||||
|
||||
@@ -18,13 +18,13 @@ local inputField1 = container:addInputField()
|
||||
local inputField2 = container:addInputField()
|
||||
:setPosition(2, 4)
|
||||
|
||||
container:setFocusedObject(inputField1)
|
||||
container:setFocusedChild(inputField1)
|
||||
|
||||
main:addButton()
|
||||
:setPosition(2, 6)
|
||||
:setText("Remove focus from input fields")
|
||||
:onClick(function()
|
||||
container:removeFocusedObject()
|
||||
container:clearFocusedChild()
|
||||
basalt.debug("Focus removed from input fields!")
|
||||
end)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## getObject
|
||||
## getChild
|
||||
|
||||
### Description
|
||||
|
||||
@@ -21,7 +21,7 @@ local button = main:addButton("myButton")
|
||||
:setText("My Button")
|
||||
|
||||
-- Get the button object by its ID
|
||||
local retrievedButton = main:getObject("myButton")
|
||||
local retrievedButton = main:getChild("myButton")
|
||||
if retrievedButton then
|
||||
basalt.debug("Button found!")
|
||||
end
|
||||
@@ -1,4 +1,4 @@
|
||||
## getDeepObject
|
||||
## getDeepChild
|
||||
|
||||
### Description
|
||||
|
||||
@@ -21,7 +21,7 @@ local button = container:addButton("myButton")
|
||||
:setPosition(2, 2)
|
||||
:setText("My Button")
|
||||
-- Get the button object by its ID, searching through all containers
|
||||
local retrievedButton = main:getDeepObject("myButton")
|
||||
local retrievedButton = main:getDeepChild("myButton")
|
||||
if retrievedButton then
|
||||
basalt.debug("Button found!")
|
||||
end
|
||||
@@ -1,4 +1,4 @@
|
||||
## removeObject
|
||||
## removeChild
|
||||
|
||||
### Description
|
||||
|
||||
@@ -25,7 +25,7 @@ main:addButton()
|
||||
:setPosition(2, 4)
|
||||
:setText("Remove the button above")
|
||||
:onClick(function()
|
||||
local removed = container:removeObject("removableButton")
|
||||
local removed = container:removeChild("removableButton")
|
||||
if removed then
|
||||
basalt.debug("Button removed!")
|
||||
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