Updated Frame (markdown)
93
Frame.md
93
Frame.md
@@ -1,63 +1,63 @@
|
||||
<a href="https://i.imgur.com/aikc0K1.png"><img src="https://i.imgur.com/aikc0K1.png" height="500" /></a>
|
||||
|
||||
Here you can find all possible functions you can use with frames:
|
||||
Frame function list:
|
||||
|
||||
# basalt.createFrame
|
||||
creates a new non-parent frame - in most cases the first thing you need.
|
||||
````lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame")
|
||||
````
|
||||
**args:** string identifaction id. if you create 2 frames with the same id, the second one will return nil<br>
|
||||
**returns:** a new frame object<br>
|
||||
**args:** string name (should be unique)<br>
|
||||
**returns:** new frame object<br>
|
||||
|
||||
# addFrame
|
||||
The same as basalt.createFrame, but it will have a parent frame
|
||||
````lua
|
||||
frame:addFrame("myFirstFrame")
|
||||
````
|
||||
**args:** string identifaction id. if you create 2 frames with the same id, the second one will return nil<br>
|
||||
**returns:** a new frame object<br>
|
||||
**args:** string name (should be unique)<br>
|
||||
**returns:** new frame object<br>
|
||||
Example:
|
||||
````lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame")
|
||||
local aFrame = mainFrame:addFrame("myFirstSubFrame")
|
||||
````
|
||||
# setTitle
|
||||
Changes the title from a frame
|
||||
# setBar
|
||||
Changes the frame bar
|
||||
````lua
|
||||
frame:setTitle("My first Frame!")
|
||||
frame:setBar("My first Frame!", colors.gray, colors.lightGray)
|
||||
````
|
||||
**args:** string text<br>
|
||||
**returns:** the frame object<br>
|
||||
**args:** string text, number bgcolor, number fgcolor<br>
|
||||
**returns:** self<br>
|
||||
Example:
|
||||
````lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame")
|
||||
local aFrame = MainFrame:addFrame("myFirstSubFrame")
|
||||
aFrame:setTitle("My first Frame!")
|
||||
aFrame:setBar("My first Frame!")
|
||||
````
|
||||
or:
|
||||
````lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame")
|
||||
local aFrame = mainFrame:addFrame("myFirstSubFrame"):setTitle("My first Frame!")
|
||||
local aFrame = mainFrame:addFrame("myFirstSubFrame"):setBar("My first Frame!")
|
||||
````
|
||||
|
||||
# setTitleAlign
|
||||
Sets the title alignment
|
||||
# setBarTextAlign
|
||||
Sets the bar text alignment
|
||||
````lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):setTitle("My first Frame!"):setTitleAlign("right")
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):setBar("My first Frame!"):setBarTextAlign("right")
|
||||
````
|
||||
**args:** string text - possible values: "left", "center", "right"<br>
|
||||
**returns:** the frame object<br>
|
||||
**args:** string value - ("left", "center", "right"))<br>
|
||||
**returns:** self<br>
|
||||
|
||||
|
||||
|
||||
# showBar
|
||||
shows/hides the bar on top where you will see the title if its active
|
||||
````lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):showBar()
|
||||
local mainFrame = basalt.createFrame("myFirstFrame")setBar("Hello World!"):showBar()
|
||||
````
|
||||
**args:** bool isVisible (no args = true)<br>
|
||||
**returns:** the frame object<br>
|
||||
**args:** bool visible (no args = true)<br>
|
||||
**returns:** self<br>
|
||||
|
||||
# isModifierActive
|
||||
returns true if user is currently holding a key down
|
||||
@@ -65,7 +65,7 @@ returns true if user is currently holding a key down
|
||||
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>
|
||||
**returns:** true or false if the user is holding the key down<br>
|
||||
**returns:** boolean - if the user is holding the key down<br>
|
||||
|
||||
**Example:**
|
||||
````lua
|
||||
@@ -79,60 +79,51 @@ else
|
||||
end)
|
||||
````
|
||||
|
||||
|
||||
# remove
|
||||
removes the frame and its children objects completly
|
||||
````lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):remove()
|
||||
````
|
||||
**args:** -<br>
|
||||
**returns:** -<br>
|
||||
|
||||
# getObject
|
||||
returns a created object (arg = id)
|
||||
returns a children object
|
||||
````lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame")
|
||||
mainFrame:addButton("myFirstButton")
|
||||
local aButton = mainFrame:getObject("myFirstButton")
|
||||
````
|
||||
**args:** the id of the created object (has to be a child from the frame<br>
|
||||
**returns:** object or nil<br>
|
||||
**args:** string name (has to be a children)<br>
|
||||
**returns:** any object<br>
|
||||
|
||||
# removeObject
|
||||
removes the object with the id
|
||||
removes the object
|
||||
````lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame")
|
||||
mainFrame:addButton("myFirstButton")
|
||||
mainFrame:removeObject("myFirstButton")
|
||||
````
|
||||
**args:** the id of the created object (has to be a child from the frame<br>
|
||||
**returns:** object or nil<br>
|
||||
**args:** string name (has to be a children)<br>
|
||||
**returns:** any object<br>
|
||||
|
||||
# setFocusedElement
|
||||
changes the currently focused element
|
||||
# setFocusedObject
|
||||
changes the currently focused object
|
||||
````lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame")
|
||||
local aButton = mainFrame:addButton("myFirstButton")
|
||||
mainFrame:setFocusedElement(aButton)
|
||||
mainFrame:setFocusedObject(aButton)
|
||||
````
|
||||
**args:** the object you want to set as focus, has to be a children<br>
|
||||
**returns:** the frame object<br>
|
||||
# removeFocusedElement
|
||||
removes the focus of the currently focused element
|
||||
**args:** any object (has to be a children)<br>
|
||||
**returns:** self<br>
|
||||
# removeFocusedObject
|
||||
removes the focus of the currently focused object
|
||||
````lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame")
|
||||
local aButton = mainFrame:addButton("myFirstButton")
|
||||
mainFrame:removeFocusedElement(aButton)
|
||||
mainFrame:removeFocusedObject(aButton)
|
||||
````
|
||||
**args:** the object you want to set as focus, has to be a children<br>
|
||||
**returns:** the frame object<br>
|
||||
**args:** any object (has to be a children)<br>
|
||||
**returns:** self<br>
|
||||
|
||||
# getFocusedElement
|
||||
gets the currently focused element
|
||||
# getFocusedObject
|
||||
gets the currently focused object
|
||||
````lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame")
|
||||
local aButton = mainFrame:addButton("myFirstButton")
|
||||
local focusedObject = mainFrame:getFocusedElement()
|
||||
local focusedObject = mainFrame:getFocusedObject()
|
||||
````
|
||||
**args:** -<br>
|
||||
**returns:** object<br>
|
||||
@@ -143,5 +134,5 @@ sets if the frame should be moveable or not (to move the frame you need to drag
|
||||
````lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):setMoveable(true)
|
||||
````
|
||||
**args:** bool<br>
|
||||
**returns:** object<br>
|
||||
**args:** bool moveable<br>
|
||||
**returns:** self<br>
|
||||
|
||||
Reference in New Issue
Block a user