Basalt 1.7 Update
- New Objects (Flexbox, Graph, Treeview) - Pluginsystem to add/remove functionality - Reworked the entire Object system, instead of one big Object Class we have multiple classes: Object, VisualObject, ChangeableObject - Instead of one big Frame Class we have multiple Frame Classes: BaseFrame, Frame, MovableFrame, ScrollableFrame, MonitorFrame, Flexbox - Removed the Animation Object, and added a animation plugin instead - Removed the Graphic Object and merged it's functionality with the image object - Updated currently existing objects
This commit is contained in:
@@ -1,7 +1,21 @@
|
||||
# Object
|
||||
## enable
|
||||
|
||||
## disable
|
||||
### Description
|
||||
|
||||
Disables the object's event listeners
|
||||
|
||||
This will disable the object. Which means it doesn't listen to any events anymore.
|
||||
If the object is enabled, it will listen to incoming events. Disabling it will stop listening to events.
|
||||
|
||||
### Returns
|
||||
|
||||
1. `object` The object in use
|
||||
|
||||
### Usage
|
||||
|
||||
* Creates a default button and disables it, then re-enables it.
|
||||
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aButton = mainFrame:addButton():setText("Disabled Button")
|
||||
aButton:disable()
|
||||
```
|
||||
|
||||
@@ -1,7 +1,21 @@
|
||||
# Object
|
||||
|
||||
## enable
|
||||
|
||||
### Description
|
||||
|
||||
Enables the object's event listeners
|
||||
|
||||
If the object's is disabled, it will stop listening to incoming events, this will reenable it.
|
||||
If the object is disabled, it will stop listening to incoming events, this will reenable it.
|
||||
|
||||
### Returns
|
||||
|
||||
1. `object` The object in use
|
||||
|
||||
### Usage
|
||||
|
||||
* Creates a default button and disables it, then re-enables it.
|
||||
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aButton = mainFrame:addButton():setText("Enabled Button")
|
||||
aButton:enable()
|
||||
```
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
## getName
|
||||
|
||||
Returns the given name of the object
|
||||
Returns the name of the object
|
||||
|
||||
### Returns
|
||||
|
||||
1. `string` name
|
||||
1. `string` The name of the object, or a uuid if no name was assigned
|
||||
|
||||
#### Usage
|
||||
|
||||
@@ -14,7 +14,7 @@ Returns the given name of the object
|
||||
|
||||
```lua
|
||||
local main = basalt.createFrame()
|
||||
basalt.debug(main:getName()) -- returns the uuid
|
||||
basalt.debug(main:getName()) -- returns a uuid
|
||||
```
|
||||
|
||||
```lua
|
||||
|
||||
22
docs/objects/Object/getParent.md
Normal file
22
docs/objects/Object/getParent.md
Normal file
@@ -0,0 +1,22 @@
|
||||
## getParent
|
||||
|
||||
### Description
|
||||
|
||||
Returns the parent of the object
|
||||
|
||||
This method is used to get the parent of the object, which is the object that contains it.
|
||||
|
||||
### Returns
|
||||
|
||||
1. `object` The parent object, or nil if the object has no parent
|
||||
|
||||
### Usage
|
||||
|
||||
* Creates a default frame with a button and gets the parent of the button.
|
||||
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aButton = mainFrame:addButton():setText("My Button")
|
||||
local parent = aButton:getParent()
|
||||
basalt.debug(parent) -- The parent object (mainFrame) will be output
|
||||
```
|
||||
21
docs/objects/Object/getType.md
Normal file
21
docs/objects/Object/getType.md
Normal file
@@ -0,0 +1,21 @@
|
||||
## getType
|
||||
|
||||
### Description
|
||||
|
||||
Returns the type of the object
|
||||
|
||||
This method is used to get the type of the object, such as 'Button', 'Label', 'List', etc.
|
||||
|
||||
### Returns
|
||||
|
||||
1. `object` The type of the object
|
||||
|
||||
### Usage
|
||||
|
||||
* Creates a default button and prints its type.
|
||||
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aButton = mainFrame:addButton():setText("My Button")
|
||||
basalt.debug(aButton:getType())
|
||||
```
|
||||
22
docs/objects/Object/getZIndex.md
Normal file
22
docs/objects/Object/getZIndex.md
Normal file
@@ -0,0 +1,22 @@
|
||||
## getZIndex
|
||||
|
||||
### Description
|
||||
|
||||
Returns the Z-index of the object
|
||||
|
||||
The Z-index determines the order of overlapping objects. Objects with higher Z-index values will be displayed above objects with lower Z-index values.
|
||||
|
||||
### Returns
|
||||
|
||||
1. `object` The current Z-index value
|
||||
|
||||
### Usage
|
||||
|
||||
* Creates a default button and gets its Z-index value.
|
||||
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aButton = mainFrame:addButton():setText("My Button")
|
||||
local zIndex = aButton:getZIndex()
|
||||
basalt.debug(zIndex) -- Prints the Z-index value
|
||||
```
|
||||
25
docs/objects/Object/isType.md
Normal file
25
docs/objects/Object/isType.md
Normal file
@@ -0,0 +1,25 @@
|
||||
## isType
|
||||
|
||||
### Description
|
||||
|
||||
Checks if the object is of a specific type or inherits from a specific parent class
|
||||
|
||||
This method is used to check if the object is of a specific type or inherits from a specific parent class, such as 'Button', 'Label', 'List', etc.
|
||||
|
||||
### Parameters
|
||||
|
||||
1. `object` The type name you want to check
|
||||
|
||||
### Returns
|
||||
|
||||
1. `boolean` Returns true if the object is of the specified type or inherits from it, otherwise false
|
||||
|
||||
### Usage
|
||||
|
||||
* Creates a default button and checks if it is of type 'Button'.
|
||||
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aButton = mainFrame:addButton():setText("My Button")
|
||||
basalt.debug(aButton:isType('Button'))
|
||||
```
|
||||
@@ -1,28 +1,29 @@
|
||||
# Object - Event
|
||||
|
||||
## onChar
|
||||
|
||||
### Description
|
||||
|
||||
`onChar(self, event, char)`
|
||||
|
||||
The computercraft event which triggers this method is `char`.
|
||||
The onChar event is triggered when a character is typed on the keyboard.
|
||||
|
||||
The char event always happens after the key event (just like in cc:tweaked)
|
||||
### Returns
|
||||
|
||||
Here is a example on how to add a onChar event to your frame:
|
||||
1. `object` The object in use
|
||||
|
||||
### Usage
|
||||
|
||||
* Add an onChar event to an object:
|
||||
|
||||
```lua
|
||||
local basalt = require("basalt")
|
||||
|
||||
local main = basalt.createFrame()
|
||||
local subFrame = main:addFrame()
|
||||
local input = main:addInput()
|
||||
:setPosition(3,3)
|
||||
:setSize(18,6)
|
||||
:hide()
|
||||
:setSize(12,1)
|
||||
|
||||
function openSubFrame(self, event, char)
|
||||
if(char=="a")then
|
||||
subFrame:show()
|
||||
end
|
||||
function inputOnChar(self, event, char)
|
||||
basalt.debug("Character typed: " .. char)
|
||||
end
|
||||
main:onChar(openSubFrame)
|
||||
input:onChar(inputOnChar)
|
||||
```
|
||||
|
||||
@@ -1,10 +1,18 @@
|
||||
# onClick
|
||||
## onClick
|
||||
|
||||
### Description
|
||||
|
||||
`onClick(self, event, button, x, y)`
|
||||
|
||||
The computercraft event which triggers this method is `mouse_click` and `monitor_touch`.
|
||||
The onClick event is triggered when a mouse click or monitor touch occurs on the object.
|
||||
|
||||
Here is a example on how to add a onClick event to your button:
|
||||
### Returns
|
||||
|
||||
1. `object` The object in use
|
||||
|
||||
### Usage
|
||||
|
||||
* Add an onClick event to a button:
|
||||
|
||||
```lua
|
||||
local basalt = require("basalt")
|
||||
@@ -21,7 +29,7 @@ end
|
||||
button:onClick(buttonOnClick)
|
||||
```
|
||||
|
||||
Here is also a example on how you could create double clicks:
|
||||
* Create double clicks:
|
||||
|
||||
```lua
|
||||
local basalt = require("basalt")
|
||||
@@ -30,7 +38,7 @@ local doubleClickMaxTime = 0.25 -- in seconds
|
||||
local main = basalt.createFrame()
|
||||
local button = main:addButton()
|
||||
|
||||
local function createDoubleClick(btn, func) -- here we create a function where we can pass buttons (or other object if you'd like to) and a function which will get called by double clicking.
|
||||
local function createDoubleClick(btn, func)
|
||||
local doubleClick = 0
|
||||
btn:onClick(function()
|
||||
if(os.epoch("local")-doubleClickMaxTime*1000<=doubleClick)then
|
||||
@@ -44,7 +52,7 @@ local function debugSomething()
|
||||
basalt.debug("hello")
|
||||
end
|
||||
|
||||
createDoubleClick(button, debugSomething) -- this is how you will create a double click.
|
||||
createDoubleClick(button, debugSomething)
|
||||
|
||||
basalt.autoUpdate()
|
||||
```
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
# Object - Event
|
||||
|
||||
## onClickUp
|
||||
|
||||
### Description
|
||||
|
||||
`onClickUp(self, event, button, x, y)`
|
||||
|
||||
The computercraft event which triggers this method is `mouse_up`.
|
||||
The onClickUp event is triggered when a mouse click is released on the object.
|
||||
|
||||
Here is a example on how to add a onClickUp event to your button:
|
||||
### Returns
|
||||
|
||||
1. `object` The object in use
|
||||
|
||||
### Usage
|
||||
|
||||
* Add an onClickUp event to a button:
|
||||
|
||||
```lua
|
||||
local basalt = require("basalt")
|
||||
@@ -17,13 +23,8 @@ local button = main:addButton()
|
||||
:setSize(12,3)
|
||||
:setText("Click")
|
||||
|
||||
function buttonOnClick(self, button, x, y)
|
||||
basalt.debug("Button got clicked!")
|
||||
function buttonOnClickUp()
|
||||
basalt.debug("Button click released!")
|
||||
end
|
||||
button:onClick(buttonOnClick)
|
||||
|
||||
function buttonOnRelease(self, button, x, y)
|
||||
basalt.debug("Button got released!")
|
||||
end
|
||||
button:onClickUp(buttonOnRelease)
|
||||
button:onClickUp(buttonOnClickUp)
|
||||
```
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
# Object - Event
|
||||
|
||||
## onDrag
|
||||
|
||||
### Description
|
||||
|
||||
`onDrag(self, event, button, x, y, xOffset, yOffset)`
|
||||
|
||||
The computercraft event which triggers this method is `mouse_drag`.
|
||||
The onDrag event is triggered when an object is being dragged with the mouse.
|
||||
|
||||
This is a example on how you would create a movable button:
|
||||
### Returns
|
||||
|
||||
1. `object` The object in use
|
||||
|
||||
### Usage
|
||||
|
||||
* Add an onDrag event to an object:
|
||||
|
||||
```lua
|
||||
local basalt = require("basalt")
|
||||
@@ -15,25 +21,22 @@ local main = basalt.createFrame()
|
||||
local button = main:addButton()
|
||||
:setPosition(3,3)
|
||||
:setSize(12,3)
|
||||
:setText("Click")
|
||||
:setText("Drag")
|
||||
|
||||
function buttonOnDrag(self, button, x, y, xOffset, yOffset)
|
||||
self:setPosition(-xOffset, -yOffset, true) -- we need to reverse the offset and true means to add the offset instead of changing it.
|
||||
function buttonOnDrag(event, button, x, y)
|
||||
basalt.debug("Button dragged at position: " .. x .. ", " .. y)
|
||||
end
|
||||
button:onDrag(buttonOnDrag)
|
||||
|
||||
basalt.autoUpdate()
|
||||
```
|
||||
|
||||
Another example on how you could change the frame's offset by dragging around.
|
||||
* You can also change the frame's offset, by dragging around:
|
||||
|
||||
```lua
|
||||
local basalt = require("basalt")
|
||||
|
||||
local main = basalt.createFrame()
|
||||
:onDrag(function(self, button, x, y, xOffset, yOffset)
|
||||
local xO, yO = self:getOffset()
|
||||
self:setOffset(xO-xOffset, yO-yOffset, true) -- we need to reverse the offset and true means to add the offset instead of changing it.
|
||||
self:setOffset(-xOffset, -yOffset, true)
|
||||
end)
|
||||
|
||||
local button = main:addButton()
|
||||
@@ -48,7 +51,7 @@ local button2 = main:addButton()
|
||||
basalt.autoUpdate()
|
||||
```
|
||||
|
||||
Also very interesting is a button where you are able to resize the frame just by dragging the button.
|
||||
* Here is a example how to resize a frame by dragging a button around:
|
||||
|
||||
```lua
|
||||
local basalt = require("basalt")
|
||||
|
||||
@@ -1,22 +1,28 @@
|
||||
# Object - Event
|
||||
|
||||
## onEvent
|
||||
|
||||
### Description
|
||||
|
||||
`onEvent(self, event, ...)`
|
||||
|
||||
This event gets called on any other event. Some examples: http_success, disk, modem_message, paste, peripheral, redstone,...
|
||||
The onEvent method is triggered for any other event that is not handled by the specific event methods. Some examples include: http_success, disk, modem_message, paste, peripheral, redstone, and more.
|
||||
|
||||
You can find a full list here: [CC:Tweaked](https://tweaked.cc/) (on the left sidebar)
|
||||
|
||||
Here is a example on how to add a onEvent event to your frame:
|
||||
### Returns
|
||||
|
||||
1. `object` The object in use
|
||||
|
||||
### Usage
|
||||
|
||||
* Add an onEvent event to your frame:
|
||||
|
||||
```lua
|
||||
local basalt = require("basalt")
|
||||
|
||||
local main = basalt.createFrame()
|
||||
main:onEvent(function(event, side, channel, replyChannel, message, distance)
|
||||
if(event=="modem_message")then
|
||||
basalt.debug("Mesage received: "..tostring(message))
|
||||
if(event == "modem_message") then
|
||||
basalt.debug("Message received: " .. tostring(message))
|
||||
end
|
||||
end)
|
||||
```
|
||||
|
||||
@@ -1,20 +1,29 @@
|
||||
# Object - Event
|
||||
|
||||
## onGetFocus
|
||||
|
||||
### Description
|
||||
|
||||
`onGetFocus(self)`
|
||||
|
||||
This event gets triggered as soon as the object is the currently focused object.
|
||||
The onGetFocus event is triggered when the object gains focus, which occurs when the object is clicked.
|
||||
|
||||
### Returns
|
||||
|
||||
1. `object` The object in use
|
||||
|
||||
### Usage
|
||||
|
||||
* Add an onGetFocus event to a textbox:
|
||||
|
||||
```lua
|
||||
local basalt = require("basalt")
|
||||
|
||||
local main = basalt.createFrame()
|
||||
local aButton = main:addButton()
|
||||
:setPosition(3,3)
|
||||
:onGetFocus(
|
||||
function(self)
|
||||
basalt.debug("Welcome back!")
|
||||
end
|
||||
)
|
||||
local textbox = main:addTextbox()
|
||||
:setPosition(3,3)
|
||||
:setSize(12,3)
|
||||
|
||||
function textboxOnGetFocus()
|
||||
basalt.debug("Textbox gained focus!")
|
||||
end
|
||||
textbox:onGetFocus(textboxOnGetFocus)
|
||||
```
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
# Object - Event
|
||||
|
||||
## onHover
|
||||
|
||||
### Description
|
||||
|
||||
`onHover(self, event, button, x, y)`
|
||||
|
||||
The computercraft event which triggers this method is `mouse_move` - only available in [CraftOS-PC](https://www.craftos-pc.cc).
|
||||
The onHover event is triggered when the mouse is moved over the object. This event is only available in [CraftOS-PC](https://www.craftos-pc.cc).
|
||||
|
||||
Here is a example on how to add a onHover event to your button:
|
||||
### Returns
|
||||
|
||||
1. `object` The object in use
|
||||
|
||||
### Usage
|
||||
|
||||
* Add an onHover event to a button:
|
||||
|
||||
```lua
|
||||
local basalt = require("basalt")
|
||||
|
||||
@@ -1,26 +1,29 @@
|
||||
# Object - Event
|
||||
|
||||
## onKey
|
||||
|
||||
### Description
|
||||
|
||||
`onKey(self, event, key)`
|
||||
|
||||
The computercraft event which triggers this method is `key` and `char`.
|
||||
The onKey event is triggered when a key is pressed on the keyboard.
|
||||
|
||||
Here is a example on how to add a onKey event to your frame:
|
||||
### Returns
|
||||
|
||||
1. `object` The object in use
|
||||
|
||||
### Usage
|
||||
|
||||
* Add an onKey event to an object:
|
||||
|
||||
```lua
|
||||
local basalt = require("basalt")
|
||||
|
||||
local main = basalt.createFrame()
|
||||
local subFrame = main:addFrame()
|
||||
local input = main:addInput()
|
||||
:setPosition(3,3)
|
||||
:setSize(18,6)
|
||||
:hide()
|
||||
:setSize(12,1)
|
||||
|
||||
function openSubFrame(self, event, key)
|
||||
if(key==keys.c)then
|
||||
subFrame:show()
|
||||
end
|
||||
function inputnOnKey(self, event, key)
|
||||
basalt.debug("Key pressed: " .. key)
|
||||
end
|
||||
main:onKey(openSubFrame)
|
||||
input:onKey(inputnOnKey)
|
||||
```
|
||||
|
||||
@@ -1,25 +1,29 @@
|
||||
# Object - Event
|
||||
|
||||
## onKeyUp
|
||||
|
||||
### Description
|
||||
|
||||
`onKeyUp(self, event, key)`
|
||||
|
||||
The computercraft event which triggers this method is `key_up`.
|
||||
The onKeyUp event is triggered when a key is released on the keyboard.
|
||||
|
||||
Here is a example on how to add a onKeyUp event to your frame:
|
||||
### Returns
|
||||
|
||||
1. `object` The object in use
|
||||
|
||||
### Usage
|
||||
|
||||
* Add an onKeyUp event to an object:
|
||||
|
||||
```lua
|
||||
local basalt = require("basalt")
|
||||
|
||||
local main = basalt.createFrame()
|
||||
local subFrame = main:addFrame()
|
||||
local input = main:addInput()
|
||||
:setPosition(3,3)
|
||||
:setSize(18,6)
|
||||
:setSize(12,1)
|
||||
|
||||
function openSubFrame(self, event, key)
|
||||
if(key==keys.c)then
|
||||
subFrame:show()
|
||||
end
|
||||
function inputnOnKeyUp(self, event, key)
|
||||
basalt.debug("Key released: " .. key)
|
||||
end
|
||||
main:onKeyUp(openSubFrame)
|
||||
input:onKeyUp(inputnOnKey)
|
||||
```
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
# Object - Event
|
||||
|
||||
## onLeave
|
||||
|
||||
### Description
|
||||
|
||||
`onLeave(self, event, button, x, y)`
|
||||
|
||||
The computercraft event which triggers this method is `mouse_move` - only available in [CraftOS-PC](https://www.craftos-pc.cc).
|
||||
The onLeave event is triggered when the mouse pointer leaves the object. The event is based on the mouse_move event, which is only available in [CraftOS-PC](https://www.craftos-pc.cc).
|
||||
|
||||
Here is a example on how to add a onLeave event to your button:
|
||||
### Returns
|
||||
|
||||
1. `object` The object in use
|
||||
|
||||
### Usage
|
||||
|
||||
* Add an onLeave event to a button:
|
||||
|
||||
```lua
|
||||
local basalt = require("basalt")
|
||||
|
||||
@@ -1,20 +1,29 @@
|
||||
# Object - Event
|
||||
|
||||
## onLoseFocus
|
||||
|
||||
### Description
|
||||
|
||||
`onLoseFocus(self)`
|
||||
|
||||
This event gets triggered as soon as the object loses its focus.
|
||||
The onLoseFocus event is triggered when the object loses focus, which occurs when another object is clicked.
|
||||
|
||||
### Returns
|
||||
|
||||
1. `object` The object in use
|
||||
|
||||
### Usage
|
||||
|
||||
* Add an onLoseFocus event to a textbox:
|
||||
|
||||
```lua
|
||||
local basalt = require("basalt")
|
||||
|
||||
local main = basalt.createFrame()
|
||||
local aButton = main:addButton()
|
||||
:setPosition(3,3)
|
||||
:onLoseFocus(
|
||||
function(self)
|
||||
basalt.debug("Please come back...")
|
||||
end
|
||||
)
|
||||
local textbox = main:addTextbox()
|
||||
:setPosition(3,3)
|
||||
:setSize(12,3)
|
||||
|
||||
function textboxOnLoseFocus()
|
||||
basalt.debug("Textbox lost focus!")
|
||||
end
|
||||
textbox:onLoseFocus(textboxOnLoseFocus)
|
||||
```
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
# Object - Event
|
||||
|
||||
## onRelease
|
||||
|
||||
### Description
|
||||
|
||||
`onRelease(self, event, button, x, y)`
|
||||
|
||||
The computercraft event which triggers this method is `mouse_up`.
|
||||
The `onRelease` event is triggered when the mouse button is released. The main difference between `onRelease` and `onClickUp` is that `onRelease` is called even when the mouse is no longer over the object, while `onClickUp` is only called when the mouse is over the object.
|
||||
|
||||
The difference between onRelease and :onClickUp is that :onRelease is called even when the mouse is no longer over the object, while :onClickUp is only called when the mouse is over the object.
|
||||
### Returns
|
||||
|
||||
Here is a example on how to add a onRelease event to your button:
|
||||
1. `object` The object in use
|
||||
|
||||
### Usage
|
||||
|
||||
* Add an onRelease event to a button:
|
||||
|
||||
```lua
|
||||
local basalt = require("basalt")
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
# Object - Event
|
||||
|
||||
## onScroll
|
||||
|
||||
`onScroll(self, event, direction, x, y)`
|
||||
|
||||
The computercraft event which triggers this method is `mouse_scroll`.
|
||||
The `onScroll` event is triggered when a mouse scroll occurs over the object.
|
||||
|
||||
Here is a example on how to add a onScroll event to your button:
|
||||
### Returns
|
||||
|
||||
1. `object` The object in use
|
||||
|
||||
### Usage
|
||||
|
||||
* Add an onScroll event to a button:
|
||||
|
||||
```lua
|
||||
local basalt = require("basalt")
|
||||
|
||||
@@ -1,15 +1,19 @@
|
||||
# Object
|
||||
|
||||
## remove
|
||||
|
||||
Removes the object from it's parent frame. This won't 'destroy' the object, It will continue to exist as long as you still have pointers to it.
|
||||
### Description
|
||||
|
||||
Here is a example on how a button will be fully removed from the memory:
|
||||
Removes the object from its parent
|
||||
|
||||
The object will no longer be visible and will not receive any events. Note that this does not destroy the object, and it can be re-added to another parent later if needed.
|
||||
|
||||
### Returns
|
||||
|
||||
1. `object` The object in use
|
||||
|
||||
### Usage
|
||||
|
||||
```lua
|
||||
local main = basalt.createFrame()
|
||||
local button = main:addButton():setPosition(2,2):setText("Close")
|
||||
|
||||
button:remove()
|
||||
button = nil
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aButton = mainFrame:addButton():setText("My Button")
|
||||
aButton:remove()
|
||||
```
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
# Object
|
||||
|
||||
## setParent
|
||||
|
||||
Sets the parent frame of the object
|
||||
### Description
|
||||
|
||||
Sets the parent of the object
|
||||
|
||||
This method is used to change the parent of the object, assigning it to a new containing object.
|
||||
|
||||
### Parameters
|
||||
|
||||
1. `frame` The to-be parent frame
|
||||
1. `object` The new parent object
|
||||
|
||||
### Returns
|
||||
|
||||
@@ -14,14 +16,11 @@ Sets the parent frame of the object
|
||||
|
||||
### Usage
|
||||
|
||||
* Sets the parent frame of the random frame, adding it to the main frame when the button is clicked"
|
||||
* Creates two frames and a button, then sets the parent of the button to the second frame
|
||||
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aRandomFrame = basalt.createFrame()
|
||||
local aButton = mainFrame:addButton():onClick(
|
||||
function()
|
||||
aRandomFrame:setParent(mainFrame)
|
||||
end
|
||||
)
|
||||
local secondFrame = basalt.createFrame()
|
||||
local aButton = mainFrame:addButton():setText("My Button")
|
||||
aButton:setParent(secondFrame) -- Sets the parent of aButton to secondFrame
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user