diff --git a/Frame.md b/Frame.md index 16e03f5..3b1a62c 100644 --- a/Frame.md +++ b/Frame.md @@ -1,63 +1,63 @@ -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
-**returns:** a new frame object
+**args:** string name (should be unique)
+**returns:** new frame object
# 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
-**returns:** a new frame object
+**args:** string name (should be unique)
+**returns:** new frame object
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
-**returns:** the frame object
+**args:** string text, number bgcolor, number fgcolor
+**returns:** self
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"
-**returns:** the frame object
+**args:** string value - ("left", "center", "right"))
+**returns:** self
# 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)
-**returns:** the frame object
+**args:** bool visible (no args = true)
+**returns:** self
# 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"
-**returns:** true or false if the user is holding the key down
+**returns:** boolean - if the user is holding the key down
**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:** -
-**returns:** -
- # 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
-**returns:** object or nil
+**args:** string name (has to be a children)
+**returns:** any object
# 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
-**returns:** object or nil
+**args:** string name (has to be a children)
+**returns:** any object
-# 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
-**returns:** the frame object
-# removeFocusedElement -removes the focus of the currently focused element +**args:** any object (has to be a children)
+**returns:** self
+# 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
-**returns:** the frame object
+**args:** any object (has to be a children)
+**returns:** self
-# 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:** -
**returns:** object
@@ -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
-**returns:** object
+**args:** bool moveable
+**returns:** self