Updated Object (markdown)
106
Object.md
106
Object.md
@@ -8,8 +8,8 @@ local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
|||||||
local button = mainFrame:addButton("myFirstButton")
|
local button = mainFrame:addButton("myFirstButton")
|
||||||
button:show()
|
button:show()
|
||||||
````
|
````
|
||||||
**args:** -<br>
|
**parameters:** -<br>
|
||||||
**returns:** the object<br>
|
**returns:** self<br>
|
||||||
|
|
||||||
## hide
|
## hide
|
||||||
hides the object
|
hides the object
|
||||||
@@ -18,16 +18,16 @@ local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
|||||||
local button = mainFrame:addButton("myFirstButton"):setText("Close"):onClick(function() mainFrame:hide() end)
|
local button = mainFrame:addButton("myFirstButton"):setText("Close"):onClick(function() mainFrame:hide() end)
|
||||||
button:show()
|
button:show()
|
||||||
````
|
````
|
||||||
**args:** -<br>
|
**parameters:** -<br>
|
||||||
**returns:** the object<br>
|
**returns:** self<br>
|
||||||
|
|
||||||
## setPosition
|
## setPosition
|
||||||
Changes the position relative to its parent frame
|
Changes the position relative to its parent frame
|
||||||
````lua
|
````lua
|
||||||
local mainFrame = basalt.createFrame("myFirstFrame"):setPosition(2,3)
|
local mainFrame = basalt.createFrame("myFirstFrame"):setPosition(2,3)
|
||||||
````
|
````
|
||||||
**args:** int x, int y[, "r"], "r" as third parameter means it will add x and y to current position instead of set it<br>
|
**parameters:** number x, number y[, boolean relative], if relative is set to true it will add/remove instead of set x, y<br>
|
||||||
**returns:** the frame object<br>
|
**returns:** self<br>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -36,24 +36,24 @@ Changes the object background color
|
|||||||
````lua
|
````lua
|
||||||
local mainFrame = basalt.createFrame("myFirstFrame"):setBackground(colors.lightGray)
|
local mainFrame = basalt.createFrame("myFirstFrame"):setBackground(colors.lightGray)
|
||||||
````
|
````
|
||||||
**args:** int color<br>
|
**parameters:** number color<br>
|
||||||
**returns:** the object<br>
|
**returns:** self<br>
|
||||||
|
|
||||||
## setForeground
|
## setForeground
|
||||||
Changes the object text color
|
Changes the object text color
|
||||||
````lua
|
````lua
|
||||||
local mainFrame = basalt.createFrame("myFirstFrame"):setForeground(colors.black)
|
local mainFrame = basalt.createFrame("myFirstFrame"):setForeground(colors.black)
|
||||||
````
|
````
|
||||||
**args:** int color<br>
|
**parameters:** number color<br>
|
||||||
**returns:** the object<br>
|
**returns:** self<br>
|
||||||
|
|
||||||
## setSize
|
## setSize
|
||||||
Changes the object size
|
Changes the object size
|
||||||
````lua
|
````lua
|
||||||
local mainFrame = basalt.createFrame("myFirstFrame"):setSize(15,5)
|
local mainFrame = basalt.createFrame("myFirstFrame"):setSize(15,5)
|
||||||
````
|
````
|
||||||
**args:** width, length<br>
|
**parameters:** number width, number length<br>
|
||||||
**returns:** the object<br>
|
**returns:** self<br>
|
||||||
|
|
||||||
## setFocus
|
## setFocus
|
||||||
sets the object to be the focused object
|
sets the object to be the focused object
|
||||||
@@ -61,8 +61,8 @@ sets the object to be the focused object
|
|||||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||||
local aButton = mainFrame:addButton("myFirstButton"):setFocus():show()
|
local aButton = mainFrame:addButton("myFirstButton"):setFocus():show()
|
||||||
````
|
````
|
||||||
**args:** -<br>
|
**parameters:** -<br>
|
||||||
**returns:** the object<br>
|
**returns:** self<br>
|
||||||
|
|
||||||
## setZIndex
|
## setZIndex
|
||||||
changes the z index (higher z index do have higher draw/event priority) 10 is more important than 5 or 1. You are also able to add multiple objects to the same z index, which means if you create a couple of buttons, you set their z index to 10, everything below 10 is less important, everything above 10 is more important. On the same z index: the last object which gets created is the most important one.
|
changes the z index (higher z index do have higher draw/event priority) 10 is more important than 5 or 1. You are also able to add multiple objects to the same z index, which means if you create a couple of buttons, you set their z index to 10, everything below 10 is less important, everything above 10 is more important. On the same z index: the last object which gets created is the most important one.
|
||||||
@@ -70,8 +70,8 @@ changes the z index (higher z index do have higher draw/event priority) 10 is mo
|
|||||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||||
local aButton = mainFrame:addButton("myFirstButton"):setZIndex(1):show()
|
local aButton = mainFrame:addButton("myFirstButton"):setZIndex(1):show()
|
||||||
````
|
````
|
||||||
**args:** index<br>
|
**parameters:** number index<br>
|
||||||
**returns:** the object<br>
|
**returns:** self<br>
|
||||||
|
|
||||||
## setParent
|
## setParent
|
||||||
changes the frame parent of that object
|
changes the frame parent of that object
|
||||||
@@ -80,8 +80,8 @@ local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
|||||||
local aRandomFrame = basalt.createFrame("aRandomFrame"):show()
|
local aRandomFrame = basalt.createFrame("aRandomFrame"):show()
|
||||||
local aButton = mainFrame:addButton("myFirstButton"):onClick(function() aRandomFrame:setParent(mainFrame) end):show()
|
local aButton = mainFrame:addButton("myFirstButton"):onClick(function() aRandomFrame:setParent(mainFrame) end):show()
|
||||||
````
|
````
|
||||||
**args:** frame object<br>
|
**parameters:** frame object<br>
|
||||||
**returns:** the object<br>
|
**returns:** self<br>
|
||||||
|
|
||||||
## isFocused
|
## isFocused
|
||||||
returns if the object is currently the focused object of the parent frame
|
returns if the object is currently the focused object of the parent frame
|
||||||
@@ -91,8 +91,8 @@ local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
|||||||
local aButton = mainFrame:addButton("myFirstButton"):show()
|
local aButton = mainFrame:addButton("myFirstButton"):show()
|
||||||
basalt.debug(aButton:isFocused()) -- shows true or false as a debug message
|
basalt.debug(aButton:isFocused()) -- shows true or false as a debug message
|
||||||
````
|
````
|
||||||
**args:** -<br>
|
**parameters:** -<br>
|
||||||
**returns:** true or false<br>
|
**returns:** boolean<br>
|
||||||
|
|
||||||
## getAnchorPosition
|
## getAnchorPosition
|
||||||
converts the x,y coordinates into the anchor coordinates of that object
|
converts the x,y coordinates into the anchor coordinates of that object
|
||||||
@@ -102,8 +102,8 @@ local mainFrame = basalt.createFrame("myFirstFrame"):setSize(15,15):show()
|
|||||||
local aButton = mainFrame:addButton("myFirstButton"):setAnchor("right","bottom"):setSize(8,1):setPosition(1,1):show()
|
local aButton = mainFrame:addButton("myFirstButton"):setAnchor("right","bottom"):setSize(8,1):setPosition(1,1):show()
|
||||||
basalt.debug(aButton:getAnchorPosition()) -- returns 7,14 (framesize - own size) instead of 1,1
|
basalt.debug(aButton:getAnchorPosition()) -- returns 7,14 (framesize - own size) instead of 1,1
|
||||||
````
|
````
|
||||||
**args:** x,y or nothing - if nothing it uses the object x,y<br>
|
**parameters:** number x, number y - or nothing (if nothing it uses the object's x, y)<br>
|
||||||
**returns:** converted coordinates<br>
|
**returns:** number x, number y (converted)<br>
|
||||||
|
|
||||||
## setAnchor
|
## setAnchor
|
||||||
sets the anchor of that object
|
sets the anchor of that object
|
||||||
@@ -112,8 +112,8 @@ sets the anchor of that object
|
|||||||
local mainFrame = basalt.createFrame("myFirstFrame"):setAnchor("right"):show()
|
local mainFrame = basalt.createFrame("myFirstFrame"):setAnchor("right"):show()
|
||||||
local aButton = mainFrame:addButton("myFirstButton"):setAnchor("bottom","right"):setSize(8,1):setPosition(1,1):show()
|
local aButton = mainFrame:addButton("myFirstButton"):setAnchor("bottom","right"):setSize(8,1):setPosition(1,1):show()
|
||||||
````
|
````
|
||||||
**args:** "left", "right", "top", "bottom" - doesn't matter which order<br>
|
**parameters:** string sides - ("left", "right", "top", "bottom") you can stack positions like so ..:setAnchor("right", "bottom")<br>
|
||||||
**returns:** the object<br>
|
**returns:** self<br>
|
||||||
|
|
||||||
## getAbsolutePosition
|
## getAbsolutePosition
|
||||||
converts the relative coordinates into absolute coordinates
|
converts the relative coordinates into absolute coordinates
|
||||||
@@ -122,8 +122,8 @@ local mainFrame = basalt.createFrame("myFirstFrame"):setPosition(3,3):show()
|
|||||||
local aButton = mainFrame:addButton("myFirstButton"):setSize(8,1):setPosition(4,2):show()
|
local aButton = mainFrame:addButton("myFirstButton"):setSize(8,1):setPosition(4,2):show()
|
||||||
basalt.debug(aButton:getAbsolutePosition()) -- returns 7,5 (frame coords + own coords) instead of 4,2
|
basalt.debug(aButton:getAbsolutePosition()) -- returns 7,5 (frame coords + own coords) instead of 4,2
|
||||||
````
|
````
|
||||||
**args:** x,y or nothing - if nothing it uses the object x,y<br>
|
**parameters:** number x, number y - or nothing (if nothing it uses the object's x, y)<br>
|
||||||
**returns:** the object<br>
|
**returns:** self<br>
|
||||||
|
|
||||||
## setTextAlign
|
## setTextAlign
|
||||||
sets the align of the object (as example buttons)
|
sets the align of the object (as example buttons)
|
||||||
@@ -131,8 +131,8 @@ sets the align of the object (as example buttons)
|
|||||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||||
local aButton = mainFrame:addButton("myFirstButton"):setSize(12,3):setTextAlign("right", "center"):setText("Dont't..."):show()
|
local aButton = mainFrame:addButton("myFirstButton"):setSize(12,3):setTextAlign("right", "center"):setText("Dont't..."):show()
|
||||||
````
|
````
|
||||||
**args:** horizontal,vertical you can use "left", "center", "right"<br>
|
**parameters:** string horizontal, string vertical - ("left", "center", "right")<br>
|
||||||
**returns:** the object<br>
|
**returns:** self<br>
|
||||||
|
|
||||||
## setValue
|
## setValue
|
||||||
sets the value of that object (input, label, checkbox, textfield, scrollbar,...)
|
sets the value of that object (input, label, checkbox, textfield, scrollbar,...)
|
||||||
@@ -140,8 +140,8 @@ sets the value of that object (input, label, checkbox, textfield, scrollbar,...)
|
|||||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||||
local aCheckbox = mainFrame:addCheckbox("myFirstCheckbox"):setValue(true):show()
|
local aCheckbox = mainFrame:addCheckbox("myFirstCheckbox"):setValue(true):show()
|
||||||
````
|
````
|
||||||
**args:** value (text,checked,number,...)<br>
|
**parameters:** any value<br>
|
||||||
**returns:** the object<br>
|
**returns:** self<br>
|
||||||
|
|
||||||
## getValue
|
## getValue
|
||||||
returns the currently saved value
|
returns the currently saved value
|
||||||
@@ -150,18 +150,18 @@ local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
|||||||
local aCheckbox = mainFrame:addCheckbox("myFirstCheckbox"):setValue(true):show()
|
local aCheckbox = mainFrame:addCheckbox("myFirstCheckbox"):setValue(true):show()
|
||||||
basalt.debug(aCheckbox:getValue()) -- returns true
|
basalt.debug(aCheckbox:getValue()) -- returns true
|
||||||
````
|
````
|
||||||
**args:**-<br>
|
**parameters:**-<br>
|
||||||
**returns:** the value<br>
|
**returns:** any value<br>
|
||||||
|
|
||||||
## getHeight/getWidth
|
## getHeight/getWidth
|
||||||
returns the height or width of that object
|
returns the height or width
|
||||||
````lua
|
````lua
|
||||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||||
local aButton = mainFrame:addButton("myFirstButton"):setSize(5,8):show()
|
local aButton = mainFrame:addButton("myFirstButton"):setSize(5,8):show()
|
||||||
basalt.debug(aButton:getHeight()) -- returns 8
|
basalt.debug(aButton:getHeight()) -- returns 8
|
||||||
````
|
````
|
||||||
**args:**-<br>
|
**parameters:**-<br>
|
||||||
**returns:** returns the height or the width<br>
|
**returns:** number height/width<br>
|
||||||
|
|
||||||
## isVisible
|
## isVisible
|
||||||
returns if the object is currently visible
|
returns if the object is currently visible
|
||||||
@@ -170,8 +170,8 @@ local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
|||||||
local aButton = mainFrame:addButton("myFirstButton"):setSize(5,8):show()
|
local aButton = mainFrame:addButton("myFirstButton"):setSize(5,8):show()
|
||||||
basalt.debug(aButton:isVisible()) -- returns true
|
basalt.debug(aButton:isVisible()) -- returns true
|
||||||
````
|
````
|
||||||
**args:**-<br>
|
**parameters:**-<br>
|
||||||
**returns:** returns the visible state of that object<br>
|
**returns:** boolean<br>
|
||||||
|
|
||||||
## getName
|
## getName
|
||||||
returns the given name of that object
|
returns the given name of that object
|
||||||
@@ -179,8 +179,8 @@ returns the given name of that object
|
|||||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||||
basalt.debug(mainFrame:getName()) -- returns myFirstFrame
|
basalt.debug(mainFrame:getName()) -- returns myFirstFrame
|
||||||
````
|
````
|
||||||
**args:**-<br>
|
**parameters:**-<br>
|
||||||
**returns:** returns the name<br>
|
**returns:** string name<br>
|
||||||
|
|
||||||
# Object Events
|
# Object Events
|
||||||
These object events are available for all objects, if a object got some unique events, you can see them in their own category
|
These object events are available for all objects, if a object got some unique events, you can see them in their own category
|
||||||
@@ -191,8 +191,8 @@ creates a mouse_click event
|
|||||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||||
local aButton = mainFrame:addButton("myFirstButton"):setSize(10,3):onClick(function(self,event,button,x,y) basalt.debug("Hellooww UwU") end):show()
|
local aButton = mainFrame:addButton("myFirstButton"):setSize(10,3):onClick(function(self,event,button,x,y) basalt.debug("Hellooww UwU") end):show()
|
||||||
````
|
````
|
||||||
**args:** function<br>
|
**parameters:** function func<br>
|
||||||
**returns:** the object<br>
|
**returns:** self<br>
|
||||||
|
|
||||||
## onClickUp
|
## onClickUp
|
||||||
creates a click_up event
|
creates a click_up event
|
||||||
@@ -200,8 +200,8 @@ creates a click_up event
|
|||||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||||
local aButton = mainFrame:addButton("myFirstButton"):setSize(10,3):onClickUp(function(self,event,button,x,y) basalt.debug("Byeeeee UwU") end):show()
|
local aButton = mainFrame:addButton("myFirstButton"):setSize(10,3):onClickUp(function(self,event,button,x,y) basalt.debug("Byeeeee UwU") end):show()
|
||||||
````
|
````
|
||||||
**args:** function<br>
|
**parameters:** function func<br>
|
||||||
**returns:** the object<br>
|
**returns:** self<br>
|
||||||
|
|
||||||
## onMouseDrag
|
## onMouseDrag
|
||||||
creates a mouse_drag event
|
creates a mouse_drag event
|
||||||
@@ -209,8 +209,8 @@ creates a mouse_drag event
|
|||||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||||
local aButton = mainFrame:addButton("myFirstButton"):setSize(10,3):onClickUp(function(self,event,button,x,y) basalt.debug("Byeeeee UwU") end):show()
|
local aButton = mainFrame:addButton("myFirstButton"):setSize(10,3):onClickUp(function(self,event,button,x,y) basalt.debug("Byeeeee UwU") end):show()
|
||||||
````
|
````
|
||||||
**args:** function<br>
|
**parameters:** function func<br>
|
||||||
**returns:** the object<br>
|
**returns:** self<br>
|
||||||
|
|
||||||
## onChange
|
## onChange
|
||||||
creates a change event (fires as soon as the value gets changed)
|
creates a change event (fires as soon as the value gets changed)
|
||||||
@@ -218,29 +218,29 @@ creates a change event (fires as soon as the value gets changed)
|
|||||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||||
local aCheckbox = mainFrame:addCheckbox("myFirstCheckbox"):onChange(function(self) basalt.debug("i got changed into "..self:getValue()) end):show()
|
local aCheckbox = mainFrame:addCheckbox("myFirstCheckbox"):onChange(function(self) basalt.debug("i got changed into "..self:getValue()) end):show()
|
||||||
````
|
````
|
||||||
**args:** function<br>
|
**parameters:** function func<br>
|
||||||
**returns:** the object<br>
|
**returns:** self<br>
|
||||||
|
|
||||||
## onKey
|
## onKey
|
||||||
creates a key(board) - event can be key or char
|
creates a key(board) - event can be key or char
|
||||||
````lua
|
````lua
|
||||||
local mainFrame = basalt.createFrame("myFirstFrame"):onKey(function(self,event,key) basalt.debug("you clicked "..key) end):show()
|
local mainFrame = basalt.createFrame("myFirstFrame"):onKey(function(self,event,key) basalt.debug("you clicked "..key) end):show()
|
||||||
````
|
````
|
||||||
**args:** function<br>
|
**parameters:** function func<br>
|
||||||
**returns:** the object<br>
|
**returns:** self<br>
|
||||||
|
|
||||||
## onLoseFocus
|
## onLoseFocus
|
||||||
creates a lose focus event
|
creates a lose focus event
|
||||||
````lua
|
````lua
|
||||||
local mainFrame = basalt.createFrame("myFirstFrame"):onLoseFocus(function(self) basalt.debug("please come back..") end):show()
|
local mainFrame = basalt.createFrame("myFirstFrame"):onLoseFocus(function(self) basalt.debug("please come back..") end):show()
|
||||||
````
|
````
|
||||||
**args:** function<br>
|
**parameters:** function func<br>
|
||||||
**returns:** the object<br>
|
**returns:** self<br>
|
||||||
|
|
||||||
## onGetFocus
|
## onGetFocus
|
||||||
creates a get focus event
|
creates a get focus event
|
||||||
````lua
|
````lua
|
||||||
local mainFrame = basalt.createFrame("myFirstFrame"):onGetFocus(function(self) basalt.debug("thanks!") end):show()
|
local mainFrame = basalt.createFrame("myFirstFrame"):onGetFocus(function(self) basalt.debug("thanks!") end):show()
|
||||||
````
|
````
|
||||||
**args:** function<br>
|
**parameters:** function func<br>
|
||||||
**returns:** the object<br>
|
**returns:** self<br>
|
||||||
Reference in New Issue
Block a user