updated Frame.md

Samkist
2022-05-19 16:17:00 -04:00
parent 1ac2faffb0
commit 183a25ee76

@@ -1,13 +1,17 @@
<a href="https://i.imgur.com/aikc0K1.png"><img src="https://i.imgur.com/aikc0K1.png" height="500" /></a> <a href="https://i.imgur.com/aikc0K1.png"><img src="https://i.imgur.com/aikc0K1.png" height="500" /></a>
Frames are like containers, but are also normal objects. Means, you can add other objects (even frames) to a frame and if the frame itself is visible, all sub objects (if they are set to visible by :show()) are also visible. A better description will follow. Frames are like containers, but are also normal objects.
In other words, you can add other objects _(even frames)_ to a frame; if the frame itself is visible
all sub-objects _(if they are set as visible)_ are also visible. A better description will follow.
## basalt.createFrame ## basalt.createFrame
creates a new non-parent frame - in most cases the first thing you need. Creates a new non-parent frame - in most cases it is the first thing you need.
````lua ````lua
local mainFrame = basalt.createFrame("myFirstFrame") local myFirstFrame = basalt.createFrame("myFirstFrame")
```` ````
**args:** string name (should be unique)<br> **Parameters:** <br>
1. string name (should be unique)<br>
**returns:** new frame object<br> **returns:** new frame object<br>
## addFrame ## addFrame
@@ -15,7 +19,7 @@ The same as basalt.createFrame, but it will have a parent frame
````lua ````lua
frame:addFrame("myFirstFrame") frame:addFrame("myFirstFrame")
```` ````
**args:** string name (should be unique)<br> **Parameters:** string name (should be unique)<br>
**returns:** new frame object<br> **returns:** new frame object<br>
Example: Example:
````lua ````lua
@@ -27,7 +31,7 @@ Changes the frame bar
````lua ````lua
frame:setBar("My first Frame!", colors.gray, colors.lightGray) frame:setBar("My first Frame!", colors.gray, colors.lightGray)
```` ````
**args:** string text, number bgcolor, number fgcolor<br> **Parameters:** string text, number bgcolor, number fgcolor<br>
**returns:** self<br> **returns:** self<br>
Example: Example:
````lua ````lua
@@ -46,7 +50,7 @@ Sets the bar text alignment
````lua ````lua
local mainFrame = basalt.createFrame("myFirstFrame"):setBar("My first Frame!"):setBarTextAlign("right") local mainFrame = basalt.createFrame("myFirstFrame"):setBar("My first Frame!"):setBarTextAlign("right")
```` ````
**args:** string value - ("left", "center", "right"))<br> **Parameters:** string value - ("left", "center", "right"))<br>
**returns:** self<br> **returns:** self<br>
@@ -56,7 +60,7 @@ shows/hides the bar on top where you will see the title if its active
````lua ````lua
local mainFrame = basalt.createFrame("myFirstFrame"):setBar("Hello World!"):showBar() local mainFrame = basalt.createFrame("myFirstFrame"):setBar("Hello World!"):showBar()
```` ````
**args:** bool visible (no args = true)<br> **Parameters:** bool visible (no Parameters = true)<br>
**returns:** self<br> **returns:** self<br>
## isModifierActive -- DISABLED this function will work very soon ## isModifierActive -- DISABLED this function will work very soon
@@ -64,7 +68,7 @@ returns true if user is currently holding a key down
````lua ````lua
local mainFrame = basalt.createFrame("myFirstFrame"):isModifierActive("shift") local mainFrame = basalt.createFrame("myFirstFrame"):isModifierActive("shift")
```` ````
**args:** int or string - int can be any os.queueEvent("key") key, or instead of int you can use the following strings: "shift", "ctrl", "alt"<br> **Parameters:** int or string - int can be any os.queueEvent("key") key, or instead of int you can use the following strings: "shift", "ctrl", "alt"<br>
**returns:** boolean - if the user is holding the key down<br> **returns:** boolean - if the user is holding the key down<br>
**Example:** **Example:**
@@ -86,7 +90,7 @@ local mainFrame = basalt.createFrame("myFirstFrame")
mainFrame:addButton("myFirstButton") mainFrame:addButton("myFirstButton")
local aButton = mainFrame:getObject("myFirstButton") local aButton = mainFrame:getObject("myFirstButton")
```` ````
**args:** string name (has to be a children)<br> **Parameters:** string name (has to be a children)<br>
**returns:** any object<br> **returns:** any object<br>
## removeObject ## removeObject
@@ -96,7 +100,7 @@ local mainFrame = basalt.createFrame("myFirstFrame")
mainFrame:addButton("myFirstButton") mainFrame:addButton("myFirstButton")
mainFrame:removeObject("myFirstButton") mainFrame:removeObject("myFirstButton")
```` ````
**args:** string name (has to be a children)<br> **Parameters:** string name (has to be a children)<br>
**returns:** any object<br> **returns:** any object<br>
## setFocusedObject ## setFocusedObject
@@ -106,7 +110,7 @@ local mainFrame = basalt.createFrame("myFirstFrame")
local aButton = mainFrame:addButton("myFirstButton") local aButton = mainFrame:addButton("myFirstButton")
mainFrame:setFocusedObject(aButton) mainFrame:setFocusedObject(aButton)
```` ````
**args:** any object (has to be a children)<br> **Parameters:** any object (has to be a children)<br>
**returns:** self<br> **returns:** self<br>
## removeFocusedObject ## removeFocusedObject
removes the focus of the currently focused object removes the focus of the currently focused object
@@ -115,7 +119,7 @@ local mainFrame = basalt.createFrame("myFirstFrame")
local aButton = mainFrame:addButton("myFirstButton") local aButton = mainFrame:addButton("myFirstButton")
mainFrame:removeFocusedObject(aButton) mainFrame:removeFocusedObject(aButton)
```` ````
**args:** any object (has to be a children)<br> **Parameters:** any object (has to be a children)<br>
**returns:** self<br> **returns:** self<br>
## getFocusedObject ## getFocusedObject
@@ -125,16 +129,21 @@ local mainFrame = basalt.createFrame("myFirstFrame")
local aButton = mainFrame:addButton("myFirstButton") local aButton = mainFrame:addButton("myFirstButton")
local focusedObject = mainFrame:getFocusedObject() local focusedObject = mainFrame:getFocusedObject()
```` ````
**args:** -<br> **Parameters:** -<br>
**returns:** object<br> **returns:** object<br>
## setMovable
## setMoveable ## setMoveable
##### _Deprecated in favor of setMovable_
sets if the frame should be moveable or not (to move the frame you need to drag it on the top bar) sets if the frame should be moveable or not (to move the frame you need to drag it on the top bar)
````lua ````lua
local mainFrame = basalt.createFrame("myFirstFrame"):setMoveable(true) local mainFrame = basalt.createFrame("myFirstFrame"):setMoveable(true)
```` ````
**args:** bool moveable<br> **Parameters:** bool moveable<br>
**returns:** self<br> **returns:** self<br>
## setOffset ## setOffset
@@ -144,5 +153,5 @@ objects are also able to ignore the offset by using :ignoreOffset() (maybe your
````lua ````lua
local mainFrame = basalt.createFrame("myFirstFrame"):setOffset(5, 3) local mainFrame = basalt.createFrame("myFirstFrame"):setOffset(5, 3)
```` ````
**args:** number x, number y (offset in x direction and offset in y direction, also doesn't matter if its a negative value or positive<br> **Parameters:** number x, number y (offset in x direction and offset in y direction, also doesn't matter if its a negative value or positive<br>
**returns:** self<br> **returns:** self<br>