Docs: basalt.createFrame

This commit is contained in:
Erb3
2022-09-12 20:44:18 +02:00
parent 6fa519be86
commit 04d5919a82

View File

@@ -1,17 +1,23 @@
## basalt.createFrame
# basalt.createFrame
Creates a new base-frame, you can have as many base-frames as you want, but only 1 can be active (visible) at the same time. Creates a new base-frame, you can have as many base-frames as you want, but only 1 can be active (visible) at the same time.
You can always switch between your base frames. You can always switch between your base frames.
Only the currently active base-frame listens to incoming events (except for some events like time-events and peripheral-events) Only the currently active base-frame listens to incoming events (except for some events like time-events and peripheral-events)
#### Parameters: ## Parameters
1. `string` id - optional (if you dont set a id it will automatically create a uuid for you) 1. `string` id - optional (if you dont set a id it will automatically create a uuid for you)
#### Returns: ## Returns
1. `frame` object 1. `frame` object
#### Usage: ## Usage
* How to use multiple base frames: * How to use multiple base frames:
```lua ```lua
local main1 = basalt.createFrame() -- Visible base frame on program start local main1 = basalt.createFrame() -- Visible base frame on program start
local main2 = basalt.createFrame() local main2 = basalt.createFrame()
@@ -24,4 +30,5 @@ main1:addButton()
end) end)
main2:addLabel() main2:addLabel()
:setText("We are currently on main2") :setText("We are currently on main2")
``` basalt.autoUpdate()
```