Updated Container docs
updated docs for container (child instead of object)
This commit is contained in:
@@ -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