Updated Frame (markdown)

Robert Jelic
2022-04-24 16:10:23 +02:00
parent d53b34c4b6
commit 282cd84413

@@ -1,17 +1,19 @@
Here are all possible functions you can use with frames: Here are all possible functions you can use with frames:
# WIP
<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>
# NyoUI.createFrame # basalt.createFrame
this function creates a new frame this function creates a new frame
````lua ````lua
local mainFrame = NyoUI.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 identifaction id. if you create 2 frames with the same id, the second one will return nil<br>
**returns:** a new frame object<br> **returns:** a new frame object<br>
# addFrame # addFrame
The same as NyoUI.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")
```` ````
@@ -19,7 +21,7 @@ frame:addFrame("myFirstFrame")
**returns:** a new frame object<br> **returns:** a new frame object<br>
Example: Example:
````lua ````lua
local mainFrame = NyoUI.createFrame("myFirstFrame") local mainFrame = basalt.createFrame("myFirstFrame")
local aFrame = mainFrame:addFrame("myFirstSubFrame") local aFrame = mainFrame:addFrame("myFirstSubFrame")
```` ````
# setTitle # setTitle
@@ -31,20 +33,20 @@ frame:setTitle("My first Frame!")
**returns:** the frame object<br> **returns:** the frame object<br>
Example: Example:
````lua ````lua
local mainFrame = NyoUI.createFrame("myFirstFrame") local mainFrame = basalt.createFrame("myFirstFrame")
local aFrame = MainFrame:addFrame("myFirstSubFrame") local aFrame = MainFrame:addFrame("myFirstSubFrame")
aFrame:setTitle("My first Frame!") aFrame:setTitle("My first Frame!")
```` ````
or: or:
````lua ````lua
local mainFrame = NyoUI.createFrame("myFirstFrame") local mainFrame = basalt.createFrame("myFirstFrame")
local aFrame = mainFrame:addFrame("myFirstSubFrame"):setTitle("My first Frame!") local aFrame = mainFrame:addFrame("myFirstSubFrame"):setTitle("My first Frame!")
```` ````
# setTitleAlign # setTitleAlign
Sets the title alignment Sets the title alignment
````lua ````lua
local mainFrame = NyoUI.createFrame("myFirstFrame"):setTitle("My first Frame!"):setTitleAlign("right") local mainFrame = basalt.createFrame("myFirstFrame"):setTitle("My first Frame!"):setTitleAlign("right")
```` ````
**args:** string text - possible values: "left", "center", "right"<br> **args:** string text - possible values: "left", "center", "right"<br>
**returns:** the frame object<br> **returns:** the frame object<br>
@@ -54,22 +56,22 @@ local mainFrame = NyoUI.createFrame("myFirstFrame"):setTitle("My first Frame!"):
# 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 = NyoUI.createFrame("myFirstFrame"):showBar() local mainFrame = basalt.createFrame("myFirstFrame"):showBar()
```` ````
**args:** bool isVisible (no args = true)<br> **args:** bool isVisible (no args = true)<br>
**returns:** the frame object<br> **returns:** the frame object<br>
# isModifierActive # isModifierActive
returns true if user is currently holding a key returns true if user is currently holding a key down
````lua ````lua
local mainFrame = NyoUI.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:** true or false if the user is holding the key down<br>
**Example:** **Example:**
````lua ````lua
local mainFrame = NyoUI.createFrame("myFirstFrame"):setSize(20,8):show() local mainFrame = basalt.createFrame("myFirstFrame"):setSize(20,8):show()
local aLabel = mainFrame:addLabel("myFirstLabel"):setText("shift inactive") local aLabel = mainFrame:addLabel("myFirstLabel"):setText("shift inactive")
mainFrame:addButton("myFirstButton"):setText("Click"):onClick(function() mainFrame:addButton("myFirstButton"):setText("Click"):onClick(function()
if(mainFrame:isModifierActive("shift")then if(mainFrame:isModifierActive("shift")then
@@ -83,7 +85,7 @@ end)
# remove # remove
removes the frame and its children objects completly removes the frame and its children objects completly
````lua ````lua
local mainFrame = NyoUI.createFrame("myFirstFrame"):remove() local mainFrame = basalt.createFrame("myFirstFrame"):remove()
```` ````
**args:** -<br> **args:** -<br>
**returns:** -<br> **returns:** -<br>
@@ -91,7 +93,7 @@ local mainFrame = NyoUI.createFrame("myFirstFrame"):remove()
# getObject # getObject
returns a created object (arg = id) returns a created object (arg = id)
````lua ````lua
local mainFrame = NyoUI.createFrame("myFirstFrame") local mainFrame = basalt.createFrame("myFirstFrame")
mainFrame:addButton("myFirstButton") mainFrame:addButton("myFirstButton")
local aButton = mainFrame:getObject("myFirstButton") local aButton = mainFrame:getObject("myFirstButton")
```` ````
@@ -101,7 +103,7 @@ local aButton = mainFrame:getObject("myFirstButton")
# removeObject # removeObject
removes the object with the id removes the object with the id
````lua ````lua
local mainFrame = NyoUI.createFrame("myFirstFrame") local mainFrame = basalt.createFrame("myFirstFrame")
mainFrame:addButton("myFirstButton") mainFrame:addButton("myFirstButton")
mainFrame:removeObject("myFirstButton") mainFrame:removeObject("myFirstButton")
```` ````
@@ -111,7 +113,7 @@ mainFrame:removeObject("myFirstButton")
# setFocusedElement # setFocusedElement
changes the currently focused element changes the currently focused element
````lua ````lua
local mainFrame = NyoUI.createFrame("myFirstFrame") local mainFrame = basalt.createFrame("myFirstFrame")
local aButton = mainFrame:addButton("myFirstButton") local aButton = mainFrame:addButton("myFirstButton")
mainFrame:setFocusedElement(aButton) mainFrame:setFocusedElement(aButton)
```` ````
@@ -120,7 +122,7 @@ mainFrame:setFocusedElement(aButton)
# removeFocusedElement # removeFocusedElement
removes the focus of the currently focused element removes the focus of the currently focused element
````lua ````lua
local mainFrame = NyoUI.createFrame("myFirstFrame") local mainFrame = basalt.createFrame("myFirstFrame")
local aButton = mainFrame:addButton("myFirstButton") local aButton = mainFrame:addButton("myFirstButton")
mainFrame:removeFocusedElement(aButton) mainFrame:removeFocusedElement(aButton)
```` ````
@@ -130,7 +132,7 @@ mainFrame:removeFocusedElement(aButton)
# getFocusedElement # getFocusedElement
gets the currently focused element gets the currently focused element
````lua ````lua
local mainFrame = NyoUI.createFrame("myFirstFrame") local mainFrame = basalt.createFrame("myFirstFrame")
local aButton = mainFrame:addButton("myFirstButton") local aButton = mainFrame:addButton("myFirstButton")
local focusedObject = mainFrame:getFocusedElement() local focusedObject = mainFrame:getFocusedElement()
```` ````
@@ -141,7 +143,7 @@ local focusedObject = mainFrame:getFocusedElement()
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 = NyoUI.createFrame("myFirstFrame"):setMoveable(true) local mainFrame = basalt.createFrame("myFirstFrame"):setMoveable(true)
```` ````
**args:** bool<br> **args:** bool<br>
**returns:** object<br> **returns:** object<br>