Updated Frame (markdown)
38
Frame.md
38
Frame.md
@@ -1,17 +1,19 @@
|
||||
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>
|
||||
|
||||
# NyoUI.createFrame
|
||||
# basalt.createFrame
|
||||
this function creates a new frame
|
||||
````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>
|
||||
**returns:** a new frame object<br>
|
||||
|
||||
# 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
|
||||
frame:addFrame("myFirstFrame")
|
||||
````
|
||||
@@ -19,7 +21,7 @@ frame:addFrame("myFirstFrame")
|
||||
**returns:** a new frame object<br>
|
||||
Example:
|
||||
````lua
|
||||
local mainFrame = NyoUI.createFrame("myFirstFrame")
|
||||
local mainFrame = basalt.createFrame("myFirstFrame")
|
||||
local aFrame = mainFrame:addFrame("myFirstSubFrame")
|
||||
````
|
||||
# setTitle
|
||||
@@ -31,20 +33,20 @@ frame:setTitle("My first Frame!")
|
||||
**returns:** the frame object<br>
|
||||
Example:
|
||||
````lua
|
||||
local mainFrame = NyoUI.createFrame("myFirstFrame")
|
||||
local mainFrame = basalt.createFrame("myFirstFrame")
|
||||
local aFrame = MainFrame:addFrame("myFirstSubFrame")
|
||||
aFrame:setTitle("My first Frame!")
|
||||
````
|
||||
or:
|
||||
````lua
|
||||
local mainFrame = NyoUI.createFrame("myFirstFrame")
|
||||
local mainFrame = basalt.createFrame("myFirstFrame")
|
||||
local aFrame = mainFrame:addFrame("myFirstSubFrame"):setTitle("My first Frame!")
|
||||
````
|
||||
|
||||
# setTitleAlign
|
||||
Sets the title alignment
|
||||
````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>
|
||||
**returns:** the frame object<br>
|
||||
@@ -54,22 +56,22 @@ local mainFrame = NyoUI.createFrame("myFirstFrame"):setTitle("My first Frame!"):
|
||||
# showBar
|
||||
shows/hides the bar on top where you will see the title if its active
|
||||
````lua
|
||||
local mainFrame = NyoUI.createFrame("myFirstFrame"):showBar()
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):showBar()
|
||||
````
|
||||
**args:** bool isVisible (no args = true)<br>
|
||||
**returns:** the frame object<br>
|
||||
|
||||
# isModifierActive
|
||||
returns true if user is currently holding a key
|
||||
returns true if user is currently holding a key down
|
||||
````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>
|
||||
**returns:** true or false if the user is holding the key down<br>
|
||||
|
||||
**Example:**
|
||||
````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")
|
||||
mainFrame:addButton("myFirstButton"):setText("Click"):onClick(function()
|
||||
if(mainFrame:isModifierActive("shift")then
|
||||
@@ -83,7 +85,7 @@ end)
|
||||
# remove
|
||||
removes the frame and its children objects completly
|
||||
````lua
|
||||
local mainFrame = NyoUI.createFrame("myFirstFrame"):remove()
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):remove()
|
||||
````
|
||||
**args:** -<br>
|
||||
**returns:** -<br>
|
||||
@@ -91,7 +93,7 @@ local mainFrame = NyoUI.createFrame("myFirstFrame"):remove()
|
||||
# getObject
|
||||
returns a created object (arg = id)
|
||||
````lua
|
||||
local mainFrame = NyoUI.createFrame("myFirstFrame")
|
||||
local mainFrame = basalt.createFrame("myFirstFrame")
|
||||
mainFrame:addButton("myFirstButton")
|
||||
local aButton = mainFrame:getObject("myFirstButton")
|
||||
````
|
||||
@@ -101,7 +103,7 @@ local aButton = mainFrame:getObject("myFirstButton")
|
||||
# removeObject
|
||||
removes the object with the id
|
||||
````lua
|
||||
local mainFrame = NyoUI.createFrame("myFirstFrame")
|
||||
local mainFrame = basalt.createFrame("myFirstFrame")
|
||||
mainFrame:addButton("myFirstButton")
|
||||
mainFrame:removeObject("myFirstButton")
|
||||
````
|
||||
@@ -111,7 +113,7 @@ mainFrame:removeObject("myFirstButton")
|
||||
# setFocusedElement
|
||||
changes the currently focused element
|
||||
````lua
|
||||
local mainFrame = NyoUI.createFrame("myFirstFrame")
|
||||
local mainFrame = basalt.createFrame("myFirstFrame")
|
||||
local aButton = mainFrame:addButton("myFirstButton")
|
||||
mainFrame:setFocusedElement(aButton)
|
||||
````
|
||||
@@ -120,7 +122,7 @@ mainFrame:setFocusedElement(aButton)
|
||||
# removeFocusedElement
|
||||
removes the focus of the currently focused element
|
||||
````lua
|
||||
local mainFrame = NyoUI.createFrame("myFirstFrame")
|
||||
local mainFrame = basalt.createFrame("myFirstFrame")
|
||||
local aButton = mainFrame:addButton("myFirstButton")
|
||||
mainFrame:removeFocusedElement(aButton)
|
||||
````
|
||||
@@ -130,7 +132,7 @@ mainFrame:removeFocusedElement(aButton)
|
||||
# getFocusedElement
|
||||
gets the currently focused element
|
||||
````lua
|
||||
local mainFrame = NyoUI.createFrame("myFirstFrame")
|
||||
local mainFrame = basalt.createFrame("myFirstFrame")
|
||||
local aButton = mainFrame:addButton("myFirstButton")
|
||||
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)
|
||||
|
||||
````lua
|
||||
local mainFrame = NyoUI.createFrame("myFirstFrame"):setMoveable(true)
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):setMoveable(true)
|
||||
````
|
||||
**args:** bool<br>
|
||||
**returns:** object<br>
|
||||
|
||||
Reference in New Issue
Block a user