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>
|
<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
|
# 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 the first thing you need.
|
||||||
````lua
|
````lua
|
||||||
local mainFrame = basalt.createFrame("myFirstFrame")
|
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>
|
**args:** string name (should be unique)<br>
|
||||||
**returns:** a new frame object<br>
|
**returns:** new frame object<br>
|
||||||
|
|
||||||
# addFrame
|
# addFrame
|
||||||
The same as basalt.createFrame, but it will have a parent frame
|
The same as basalt.createFrame, but it will have a parent frame
|
||||||
````lua
|
````lua
|
||||||
frame:addFrame("myFirstFrame")
|
frame:addFrame("myFirstFrame")
|
||||||
````
|
````
|
||||||
**args:** string identifaction id. if you create 2 frames with the same id, the second one will return nil<br>
|
**args:** string name (should be unique)<br>
|
||||||
**returns:** a new frame object<br>
|
**returns:** new frame object<br>
|
||||||
Example:
|
Example:
|
||||||
````lua
|
````lua
|
||||||
local mainFrame = basalt.createFrame("myFirstFrame")
|
local mainFrame = basalt.createFrame("myFirstFrame")
|
||||||
local aFrame = mainFrame:addFrame("myFirstSubFrame")
|
local aFrame = mainFrame:addFrame("myFirstSubFrame")
|
||||||
````
|
````
|
||||||
# setTitle
|
# setBar
|
||||||
Changes the title from a frame
|
Changes the frame bar
|
||||||
````lua
|
````lua
|
||||||
frame:setTitle("My first Frame!")
|
frame:setBar("My first Frame!", colors.gray, colors.lightGray)
|
||||||
````
|
````
|
||||||
**args:** string text<br>
|
**args:** string text, number bgcolor, number fgcolor<br>
|
||||||
**returns:** the frame object<br>
|
**returns:** self<br>
|
||||||
Example:
|
Example:
|
||||||
````lua
|
````lua
|
||||||
local mainFrame = basalt.createFrame("myFirstFrame")
|
local mainFrame = basalt.createFrame("myFirstFrame")
|
||||||
local aFrame = MainFrame:addFrame("myFirstSubFrame")
|
local aFrame = MainFrame:addFrame("myFirstSubFrame")
|
||||||
aFrame:setTitle("My first Frame!")
|
aFrame:setBar("My first Frame!")
|
||||||
````
|
````
|
||||||
or:
|
or:
|
||||||
````lua
|
````lua
|
||||||
local mainFrame = basalt.createFrame("myFirstFrame")
|
local mainFrame = basalt.createFrame("myFirstFrame")
|
||||||
local aFrame = mainFrame:addFrame("myFirstSubFrame"):setTitle("My first Frame!")
|
local aFrame = mainFrame:addFrame("myFirstSubFrame"):setBar("My first Frame!")
|
||||||
````
|
````
|
||||||
|
|
||||||
# setTitleAlign
|
# setBarTextAlign
|
||||||
Sets the title alignment
|
Sets the bar text alignment
|
||||||
````lua
|
````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>
|
**args:** string value - ("left", "center", "right"))<br>
|
||||||
**returns:** the frame object<br>
|
**returns:** self<br>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# showBar
|
# showBar
|
||||||
shows/hides the bar on top where you will see the title if its active
|
shows/hides the bar on top where you will see the title if its active
|
||||||
````lua
|
````lua
|
||||||
local mainFrame = basalt.createFrame("myFirstFrame"):showBar()
|
local mainFrame = basalt.createFrame("myFirstFrame")setBar("Hello World!"):showBar()
|
||||||
````
|
````
|
||||||
**args:** bool isVisible (no args = true)<br>
|
**args:** bool visible (no args = true)<br>
|
||||||
**returns:** the frame object<br>
|
**returns:** self<br>
|
||||||
|
|
||||||
# isModifierActive
|
# isModifierActive
|
||||||
returns true if user is currently holding a key down
|
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")
|
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>
|
**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:**
|
**Example:**
|
||||||
````lua
|
````lua
|
||||||
@@ -79,60 +79,51 @@ else
|
|||||||
end)
|
end)
|
||||||
````
|
````
|
||||||
|
|
||||||
|
|
||||||
# remove
|
|
||||||
removes the frame and its children objects completly
|
|
||||||
````lua
|
|
||||||
local mainFrame = basalt.createFrame("myFirstFrame"):remove()
|
|
||||||
````
|
|
||||||
**args:** -<br>
|
|
||||||
**returns:** -<br>
|
|
||||||
|
|
||||||
# getObject
|
# getObject
|
||||||
returns a created object (arg = id)
|
returns a children object
|
||||||
````lua
|
````lua
|
||||||
local mainFrame = basalt.createFrame("myFirstFrame")
|
local mainFrame = basalt.createFrame("myFirstFrame")
|
||||||
mainFrame:addButton("myFirstButton")
|
mainFrame:addButton("myFirstButton")
|
||||||
local aButton = mainFrame:getObject("myFirstButton")
|
local aButton = mainFrame:getObject("myFirstButton")
|
||||||
````
|
````
|
||||||
**args:** the id of the created object (has to be a child from the frame<br>
|
**args:** string name (has to be a children)<br>
|
||||||
**returns:** object or nil<br>
|
**returns:** any object<br>
|
||||||
|
|
||||||
# removeObject
|
# removeObject
|
||||||
removes the object with the id
|
removes the object
|
||||||
````lua
|
````lua
|
||||||
local mainFrame = basalt.createFrame("myFirstFrame")
|
local mainFrame = basalt.createFrame("myFirstFrame")
|
||||||
mainFrame:addButton("myFirstButton")
|
mainFrame:addButton("myFirstButton")
|
||||||
mainFrame:removeObject("myFirstButton")
|
mainFrame:removeObject("myFirstButton")
|
||||||
````
|
````
|
||||||
**args:** the id of the created object (has to be a child from the frame<br>
|
**args:** string name (has to be a children)<br>
|
||||||
**returns:** object or nil<br>
|
**returns:** any object<br>
|
||||||
|
|
||||||
# setFocusedElement
|
# setFocusedObject
|
||||||
changes the currently focused element
|
changes the currently focused object
|
||||||
````lua
|
````lua
|
||||||
local mainFrame = basalt.createFrame("myFirstFrame")
|
local mainFrame = basalt.createFrame("myFirstFrame")
|
||||||
local aButton = mainFrame:addButton("myFirstButton")
|
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>
|
**args:** any object (has to be a children)<br>
|
||||||
**returns:** the frame object<br>
|
**returns:** self<br>
|
||||||
# removeFocusedElement
|
# removeFocusedObject
|
||||||
removes the focus of the currently focused element
|
removes the focus of the currently focused object
|
||||||
````lua
|
````lua
|
||||||
local mainFrame = basalt.createFrame("myFirstFrame")
|
local mainFrame = basalt.createFrame("myFirstFrame")
|
||||||
local aButton = mainFrame:addButton("myFirstButton")
|
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>
|
**args:** any object (has to be a children)<br>
|
||||||
**returns:** the frame object<br>
|
**returns:** self<br>
|
||||||
|
|
||||||
# getFocusedElement
|
# getFocusedObject
|
||||||
gets the currently focused element
|
gets the currently focused object
|
||||||
````lua
|
````lua
|
||||||
local mainFrame = basalt.createFrame("myFirstFrame")
|
local mainFrame = basalt.createFrame("myFirstFrame")
|
||||||
local aButton = mainFrame:addButton("myFirstButton")
|
local aButton = mainFrame:addButton("myFirstButton")
|
||||||
local focusedObject = mainFrame:getFocusedElement()
|
local focusedObject = mainFrame:getFocusedObject()
|
||||||
````
|
````
|
||||||
**args:** -<br>
|
**args:** -<br>
|
||||||
**returns:** object<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
|
````lua
|
||||||
local mainFrame = basalt.createFrame("myFirstFrame"):setMoveable(true)
|
local mainFrame = basalt.createFrame("myFirstFrame"):setMoveable(true)
|
||||||
````
|
````
|
||||||
**args:** bool<br>
|
**args:** bool moveable<br>
|
||||||
**returns:** object<br>
|
**returns:** self<br>
|
||||||
|
|||||||
Reference in New Issue
Block a user