Skip to content

Commit 47a4706

Browse files
committed
Updated Container docs
updated docs for container (child instead of object)
1 parent a8d08c8 commit 47a4706

File tree

8 files changed

+40
-17
lines changed

8 files changed

+40
-17
lines changed

docs/objects/Container.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ In addition to the Object and VisualObject methods, container objects have the f
44

55
| | |
66
|---|---|
7-
|[addObject](objects/Container/addObject.md)|Adds a new object to the container
8-
|[getObject](objects/Container/getObject.md)|Returns an object in the container by its ID
9-
|[getDeepObject](objects/Container/getDeepObject.md)|Returns an object in the container or its sub-containers by its ID
10-
|[removeObject](objects/Container/removeObject.md)|Removes an object from the container by its ID
7+
|[addChild](objects/Container/addChild.md)|Adds a new object to the container
8+
|[getChild](objects/Container/getChild.md)|Returns an object in the container by its ID
9+
|[getDeepChild](objects/Container/getDeepChild.md)|Returns an object in the container or its sub-containers by its ID
10+
|[removeChild](objects/Container/removeChild.md)|Removes an object from the container by its ID
11+
|[removeChildren](objects/Container/removeChildren.md)|Removes all children object's
1112
|[updateZIndex](objects/Container/updateZIndex.md)|Updates the Z-index of an object in the container
1213
|[setImportant](objects/Container/setImportant.md)|Marks an object as important, so it is displayed on top if needed
1314
|[sortElementOrder](objects/Container/sortElementOrder.md)|Sorts the order of elements in the container based on their Z-indices
14-
|[removeFocusedObject](objects/Container/removeFocusedObject.md)|Removes focus from an object in the container
15-
|[setFocusedObject](objects/Container/setFocusedObject.md)|Sets focus on a specific object in the container
15+
|[clearFocusedChild](objects/Container/clearFocusedChild.md)|Removes focus from an object in the container
16+
|[setFocusedChild](objects/Container/setFocusedChild.md)|Sets focus on a specific object in the container
1617

1718
A Container Object inherits from VisualObject, but won't draw children objects.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## addObject
1+
## addChild
22

33
### Description
44

docs/objects/Container/removeFocusedObject.md renamed to docs/objects/Container/clearFocusedChild.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
## removeFocusedObject
1+
## clearFocusedChild
22

33
### Description
44

5-
Removes the focus from the currently focused object within the container. If no object is focused, this method has no effect.
5+
Clears the focus from the currently focused object within the container. If no object is focused, this method has no effect.
66

77
### Returns
88

@@ -18,13 +18,13 @@ local inputField1 = container:addInputField()
1818
local inputField2 = container:addInputField()
1919
:setPosition(2, 4)
2020

21-
container:setFocusedObject(inputField1)
21+
container:setFocusedChild(inputField1)
2222

2323
main:addButton()
2424
:setPosition(2, 6)
2525
:setText("Remove focus from input fields")
2626
:onClick(function()
27-
container:removeFocusedObject()
27+
container:clearFocusedChild()
2828
basalt.debug("Focus removed from input fields!")
2929
end)
3030

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## getObject
1+
## getChild
22

33
### Description
44

@@ -21,7 +21,7 @@ local button = main:addButton("myButton")
2121
:setText("My Button")
2222

2323
-- Get the button object by its ID
24-
local retrievedButton = main:getObject("myButton")
24+
local retrievedButton = main:getChild("myButton")
2525
if retrievedButton then
2626
basalt.debug("Button found!")
2727
end
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## getDeepObject
1+
## getDeepChild
22

33
### Description
44

@@ -21,7 +21,7 @@ local button = container:addButton("myButton")
2121
:setPosition(2, 2)
2222
:setText("My Button")
2323
-- Get the button object by its ID, searching through all containers
24-
local retrievedButton = main:getDeepObject("myButton")
24+
local retrievedButton = main:getDeepChild("myButton")
2525
if retrievedButton then
2626
basalt.debug("Button found!")
2727
end
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## removeObject
1+
## removeChild
22

33
### Description
44

@@ -25,7 +25,7 @@ main:addButton()
2525
:setPosition(2, 4)
2626
:setText("Remove the button above")
2727
:onClick(function()
28-
local removed = container:removeObject("removableButton")
28+
local removed = container:removeChild("removableButton")
2929
if removed then
3030
basalt.debug("Button removed!")
3131
else
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## removeChildren
2+
3+
### Description
4+
5+
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.
6+
7+
### Returns
8+
9+
1. `object` The object in use
10+
11+
### Usage
12+
13+
```lua
14+
local mainFrame = basalt.createFrame()
15+
16+
-- Add some child objects to the frame
17+
mainFrame:addLabel("label1", "Hello", 5, 5)
18+
mainFrame:addButton("button1", "Click Me", 5, 10)
19+
20+
-- Remove all child objects from the frame
21+
mainFrame:removeChildren()
22+
```
File renamed without changes.

0 commit comments

Comments
 (0)