bad syntax fix

This commit is contained in:
Samuel Pizette
2022-06-09 11:08:26 -04:00
parent 42f1870475
commit cb98307e44
25 changed files with 296 additions and 296 deletions

View File

@@ -10,16 +10,16 @@ Just use the following command in any CC:Tweaked shell:
This will download `basalt.lua` to your local directory This will download `basalt.lua` to your local directory
To load the framework, make use of the following snippet To load the framework, make use of the following snippet
````lua ```lua
--> For those who are unfamiliar with lua, dofile executes the code in the referenced file --> For those who are unfamiliar with lua, dofile executes the code in the referenced file
local basalt = dofile("basalt.lua") local basalt = dofile("basalt.lua")
```` ```
Here is a fully functioning example of Basalt code Here is a fully functioning example of Basalt code
````lua ```lua
local basalt = dofile("basalt.lua") --> Load the Basalt framework local basalt = dofile("basalt.lua") --> Load the Basalt framework
--> Create the first frame. Please note that Basalt needs at least one active "non-parent" frame to properly supply events --> Create the first frame. Please note that Basalt needs at least one active "non-parent" frame to properly supply events
@@ -50,9 +50,9 @@ button:onClick(buttonClick)
button:show() --> Make the button visible, so the user can click it button:show() --> Make the button visible, so the user can click it
basalt.autoUpdate() --> Basalt#autoUpdate starts the event listener to detect user input basalt.autoUpdate() --> Basalt#autoUpdate starts the event listener to detect user input
```` ```
If you're like us and strive for succinct and beautiful code, here is a cleaner implementation of the code above: If you're like us and strive for succinct and beautiful code, here is a cleaner implementation of the code above:
````lua ```lua
local basalt = dofile("basalt.lua") local basalt = dofile("basalt.lua")
local mainFrame = basalt.createFrame("mainFrame"):show() local mainFrame = basalt.createFrame("mainFrame"):show()
@@ -67,4 +67,4 @@ local button = mainFrame --> Basalt returns an instance of the object on most me
:show() :show()
basalt.autoUpdate() basalt.autoUpdate()
```` ```

View File

@@ -12,15 +12,15 @@ Just use the following command in any CC:Tweaked shell:
This will download `basalt.lua` to your local directory. This will download `basalt.lua` to your local directory.
To load the framework, make use of the following snippet: To load the framework, make use of the following snippet:
````lua ```lua
--> For those who are unfamiliar with lua, dofile executes the code in the referenced file --> For those who are unfamiliar with lua, dofile executes the code in the referenced file
local basalt = dofile("basalt.lua") local basalt = dofile("basalt.lua")
```` ```
Here is a fully functioning example of Basalt code: Here is a fully functioning example of Basalt code:
````lua ```lua
local basalt = dofile("basalt.lua") --> Load the Basalt framework local basalt = dofile("basalt.lua") --> Load the Basalt framework
--> Create the first frame. Please note that Basalt needs at least one active "non-parent" frame to properly supply events --> Create the first frame. Please note that Basalt needs at least one active "non-parent" frame to properly supply events
@@ -51,9 +51,9 @@ button:onClick(buttonClick)
button:show() --> Make the button visible, so the user can click it button:show() --> Make the button visible, so the user can click it
basalt.autoUpdate() --> Basalt#autoUpdate starts the event listener to detect user input basalt.autoUpdate() --> Basalt#autoUpdate starts the event listener to detect user input
```` ```
If you're like us and strive for succinct and beautiful code, here is a cleaner implementation of the code above: If you're like us and strive for succinct and beautiful code, here is a cleaner implementation of the code above:
````lua ```lua
local basalt = dofile("basalt.lua") local basalt = dofile("basalt.lua")
local mainFrame = basalt.createFrame("mainFrame"):show() local mainFrame = basalt.createFrame("mainFrame"):show()
@@ -68,4 +68,4 @@ local button = mainFrame --> Basalt returns an instance of the object on most me
:show() :show()
basalt.autoUpdate() basalt.autoUpdate()
```` ```

View File

@@ -5,7 +5,7 @@ This is just a script which helps you to install basalt.lua, if it's not already
## Visual Installer ## Visual Installer
This is a visual version, it asks the user if he wants to install basalt.lua (if not found)<br> This is a visual version, it asks the user if he wants to install basalt.lua (if not found)<br>
![](https://i.imgur.com/b4Ys7FB.png) ![](https://i.imgur.com/b4Ys7FB.png)
````lua ```lua
--Basalt configurated installer --Basalt configurated installer
local filePath = "basalt.lua" --here you can change the file path default: basalt.lua local filePath = "basalt.lua" --here you can change the file path default: basalt.lua
if not(fs.exists(filePath))then if not(fs.exists(filePath))then
@@ -59,11 +59,11 @@ if not(fs.exists(filePath))then
end end
local basalt = dofile(filePath) -- here you can change the variablename in any variablename you want default: basalt local basalt = dofile(filePath) -- here you can change the variablename in any variablename you want default: basalt
```` ```
## Basic Installer ## Basic Installer
Here is a very basic one which just installs basalt.lua if don't exist: Here is a very basic one which just installs basalt.lua if don't exist:
````lua ```lua
--Basalt configurated installer --Basalt configurated installer
local filePath = "basalt.lua" --here you can change the file path default: basalt.lua local filePath = "basalt.lua" --here you can change the file path default: basalt.lua
if not(fs.exists(filePath))then if not(fs.exists(filePath))then
@@ -71,4 +71,4 @@ if not(fs.exists(filePath))then
end end
local basalt = dofile(filePath) -- here you can change the variablename in any variablename you want default: basalt local basalt = dofile(filePath) -- here you can change the variablename in any variablename you want default: basalt
```` ```

View File

@@ -31,13 +31,13 @@ Sets a wait timer for the next function after the previous function got executed
1. `animation` Animation in use 1. `animation` Animation in use
#### Usage: #### Usage:
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local testButton = mainFrame:addButton("myTestButton"):show() local testButton = mainFrame:addButton("myTestButton"):show()
local aAnimation = mainFrame:addAnimation("anim1"):add(function() testButton:setPosition(3,3) end):wait(1):add(function() testButton:setPosition(1,1,"r") end):wait(2):add(function() testButton:setPosition(1,1,"r") end) local aAnimation = mainFrame:addAnimation("anim1"):add(function() testButton:setPosition(3,3) end):wait(1):add(function() testButton:setPosition(1,1,"r") end):wait(2):add(function() testButton:setPosition(1,1,"r") end)
aAnimation:play() aAnimation:play()
```` ```
## play ## play
Plays the animation Plays the animation
@@ -48,13 +48,13 @@ Plays the animation
1. `animation` Animation in use 1. `animation` Animation in use
#### Usage: #### Usage:
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local testButton = mainFrame:addButton("myTestButton"):show() local testButton = mainFrame:addButton("myTestButton"):show()
local aAnimation = mainFrame:addAnimation("anim1"):add(function() testButton:setBackground(colors.black) end):wait(1):add(function() testButton:setBackground(colors.gray) end):wait(1):add(function() testButton:setBackground(colors.lightGray) end) local aAnimation = mainFrame:addAnimation("anim1"):add(function() testButton:setBackground(colors.black) end):wait(1):add(function() testButton:setBackground(colors.gray) end):wait(1):add(function() testButton:setBackground(colors.lightGray) end)
aAnimation:play() -- changes the background color of that button from black to gray and then to lightGray aAnimation:play() -- changes the background color of that button from black to gray and then to lightGray
```` ```
## cancel ## cancel
Cancels the animation Cancels the animation
@@ -64,10 +64,10 @@ Cancels the animation
#### Usage: #### Usage:
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local testButton = mainFrame:addButton("myTestButton"):show() local testButton = mainFrame:addButton("myTestButton"):show()
local aAnimation = mainFrame:addAnimation("anim1"):add(function() testButton:setBackground(colors.black) end):wait(1):add(function() aAnimation:cancel() end):wait(1):add(function() testButton:setBackground(colors.lightGray) end) local aAnimation = mainFrame:addAnimation("anim1"):add(function() testButton:setBackground(colors.black) end):wait(1):add(function() aAnimation:cancel() end):wait(1):add(function() testButton:setBackground(colors.lightGray) end)
aAnimation:play() aAnimation:play()
```` ```

View File

@@ -16,9 +16,9 @@ Create a frame without a parent
#### Usage: #### Usage:
* Create and show a frame with id "myFirstFrame" * Create and show a frame with id "myFirstFrame"
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
```` ```
## basalt.removeFrame ## basalt.removeFrame
Removes a frame (only possible for non-parent frames) Removes a frame (only possible for non-parent frames)
@@ -28,10 +28,10 @@ Removes a frame (only possible for non-parent frames)
#### Usage: #### Usage:
* Removes the previously created frame with id "myFirstFrame" * Removes the previously created frame with id "myFirstFrame"
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
basalt.removeFrame("myFirstFrame") basalt.removeFrame("myFirstFrame")
```` ```
## basalt.getFrame ## basalt.getFrame
With that function you can get frames, but only frames without a parent! With that function you can get frames, but only frames without a parent!
@@ -43,10 +43,10 @@ With that function you can get frames, but only frames without a parent!
#### Usage: #### Usage:
* Creates, fetches and shows the "myFirstFrame" object * Creates, fetches and shows the "myFirstFrame" object
````lua ```lua
basalt.createFrame("myFirstFrame") basalt.createFrame("myFirstFrame")
basalt.getFrame("myFirstFrame"):show() basalt.getFrame("myFirstFrame"):show()
```` ```
## basalt.getActiveFrame ## basalt.getActiveFrame
@@ -57,20 +57,20 @@ Returns the currently active (without a parent) frame
#### Usage: #### Usage:
* Displays the active frame name in the debug console * Displays the active frame name in the debug console
````lua ```lua
basalt.createFrame("myFirstFrame"):show() basalt.createFrame("myFirstFrame"):show()
basalt.debug(basalt.getActiveFrame():getName()) -- returns myFirstFrame basalt.debug(basalt.getActiveFrame():getName()) -- returns myFirstFrame
```` ```
## basalt.autoUpdate ## basalt.autoUpdate
Starts the draw and event handler until basalt.stopUpdate() is called Starts the draw and event handler until basalt.stopUpdate() is called
#### Usage: #### Usage:
* Enable the basalt updates, otherwise the screen will not continue to update * Enable the basalt updates, otherwise the screen will not continue to update
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
basalt.autoUpdate() basalt.autoUpdate()
```` ```
## basalt.update ## basalt.update
@@ -82,7 +82,7 @@ Calls the draw and event handler method once
#### Usage: #### Usage:
* Prints "Left Mouse Button clicked!" when clicked * Prints "Left Mouse Button clicked!" when clicked
````lua ```lua
quitButton:onClick( quitButton:onClick(
function(obj, event, x, y) function(obj, event, x, y)
if(event == "mouse_click") and (button == 1) then --> The button at index 1 is left if(event == "mouse_click") and (button == 1) then --> The button at index 1 is left
@@ -90,14 +90,14 @@ quitButton:onClick(
end end
end end
) )
```` ```
## basalt.stopUpdate ## basalt.stopUpdate
Stops the draw and event handler _(including, but not limited to mouse clicks)_ Stops the draw and event handler _(including, but not limited to mouse clicks)_
#### Usage: #### Usage:
* When the quit button is clicked, the button stops basalt updates and clears the terminal * When the quit button is clicked, the button stops basalt updates and clears the terminal
````lua ```lua
quitButton:onClick( quitButton:onClick(
function(obj, event) function(obj, event)
if (event == "mouse_click") and (obj == quitButton) then --> The button at index 1 is left if (event == "mouse_click") and (obj == quitButton) then --> The button at index 1 is left
@@ -106,7 +106,7 @@ quitButton:onClick(
end end
end end
) )
```` ```
## basalt.debug ## basalt.debug
@@ -117,7 +117,7 @@ creates a label with some information on the main frame on the bottom left, if y
#### Usage: #### Usage:
* Prints "Hello! ^-^" to the debug console * Prints "Hello! ^-^" to the debug console
````lua ```lua
basalt.debug("Hello! ^-^") basalt.debug("Hello! ^-^")
```` ```

View File

@@ -5,20 +5,20 @@ Remember button also inherits from [Object](objects/Object.md)
## setText ## setText
Sets the displayed button text Sets the displayed button text
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aButton = mainFrame:addButton("myFirstButton"):setText("Click"):show() -- you could also use :setValue() instead of :setText() - no difference local aButton = mainFrame:addButton("myFirstButton"):setText("Click"):show() -- you could also use :setValue() instead of :setText() - no difference
```` ```
**Arguments:** string text<br> **Arguments:** string text<br>
**returns:** self<br> **returns:** self<br>
# Examples # Examples
Add a onClick event: Add a onClick event:
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aButton = mainFrame:addButton("myFirstButton"):setText("Click"):onClick(function(self,event,button,x,y) local aButton = mainFrame:addButton("myFirstButton"):setText("Click"):onClick(function(self,event,button,x,y)
if(event=="mouse_click")and(button==1)then if(event=="mouse_click")and(button==1)then
basalt.debug("Left mousebutton got clicked!") basalt.debug("Left mousebutton got clicked!")
end end
end):show() end):show()
```` ```

View File

@@ -5,9 +5,9 @@ Remember button also inherits from [Object](objects/Object.md)
Create a onChange event: Create a onChange event:
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aCheckbox = mainFrame:addCheckbox("myFirstCheckbox"):onChange(function(self) basalt.debug("The value got changed into "..self:getValue()) end):show() local aCheckbox = mainFrame:addCheckbox("myFirstCheckbox"):onChange(function(self) basalt.debug("The value got changed into "..self:getValue()) end):show()
```` ```

View File

@@ -2,10 +2,10 @@ Dropdowns are objects where you can create endless entrys the user can click on
Here is a example of how to create a standard dropdown: Here is a example of how to create a standard dropdown:
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show() local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show()
```` ```
Here are all possible functions available for dropdowns: <br> Here are all possible functions available for dropdowns: <br>
Remember Dropdown also inherits from [Object](objects/Object.md) Remember Dropdown also inherits from [Object](objects/Object.md)
@@ -13,166 +13,166 @@ Remember Dropdown also inherits from [Object](objects/Object.md)
## addItem ## addItem
Adds a item to the dropdown Adds a item to the dropdown
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show() local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show()
aDropdown:addItem("1. Entry") aDropdown:addItem("1. Entry")
aDropdown:addItem("2. Entry",colors.yellow) aDropdown:addItem("2. Entry",colors.yellow)
aDropdown:addItem("3. Entry",colors.yellow,colors.green) aDropdown:addItem("3. Entry",colors.yellow,colors.green)
```` ```
**parameters:** string text, number bgcolor, number fgcolor, any ... - (text is the displayed text, bgcolor and fgcolors the colors of background/text and args (...) is something dynamic, you wont see them but if you require some more information per item you can use that)<br> **parameters:** string text, number bgcolor, number fgcolor, any ... - (text is the displayed text, bgcolor and fgcolors the colors of background/text and args (...) is something dynamic, you wont see them but if you require some more information per item you can use that)<br>
**returns:** self<br> **returns:** self<br>
## removeItem ## removeItem
Removes a item from the dropdown Removes a item from the dropdown
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show() local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show()
aDropdown:addItem("1. Entry") aDropdown:addItem("1. Entry")
aDropdown:addItem("2. Entry",colors.yellow) aDropdown:addItem("2. Entry",colors.yellow)
aDropdown:addItem("3. Entry",colors.yellow,colors.green) aDropdown:addItem("3. Entry",colors.yellow,colors.green)
aDropdown:removeItem(2) aDropdown:removeItem(2)
```` ```
**parameters:** number index<br> **parameters:** number index<br>
**returns:** self<br> **returns:** self<br>
## editItem ## editItem
Edits a item on the dropdown Edits a item on the dropdown
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show() local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show()
aDropdown:addItem("1. Entry") aDropdown:addItem("1. Entry")
aDropdown:addItem("2. Entry",colors.yellow) aDropdown:addItem("2. Entry",colors.yellow)
aDropdown:addItem("3. Entry",colors.yellow,colors.green) aDropdown:addItem("3. Entry",colors.yellow,colors.green)
aDropdown:editItem(3,"3. Edited Entry",colors.yellow,colors.green) aDropdown:editItem(3,"3. Edited Entry",colors.yellow,colors.green)
```` ```
**parameters:** number index, string text, number bgcolor, number fgcolor, any ...<br> **parameters:** number index, string text, number bgcolor, number fgcolor, any ...<br>
**returns:** self<br> **returns:** self<br>
## setScrollable ## setScrollable
Makes the dropdown scrollable Makes the dropdown scrollable
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show() local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show()
aDropdown:addItem("1. Entry") aDropdown:addItem("1. Entry")
aDropdown:addItem("2. Entry",colors.yellow) aDropdown:addItem("2. Entry",colors.yellow)
aDropdown:addItem("3. Entry",colors.yellow,colors.green) aDropdown:addItem("3. Entry",colors.yellow,colors.green)
aDropdown:setScrollable(true) aDropdown:setScrollable(true)
```` ```
**parameters:** boolean isScrollable<br> **parameters:** boolean isScrollable<br>
**returns:** self<br> **returns:** self<br>
## selectItem ## selectItem
selects a item in the dropdown (same as a player would click on a item) selects a item in the dropdown (same as a player would click on a item)
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show() local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show()
aDropdown:addItem("1. Entry") aDropdown:addItem("1. Entry")
aDropdown:addItem("2. Entry",colors.yellow) aDropdown:addItem("2. Entry",colors.yellow)
aDropdown:addItem("3. Entry",colors.yellow,colors.green) aDropdown:addItem("3. Entry",colors.yellow,colors.green)
aDropdown:selectItem(1) aDropdown:selectItem(1)
```` ```
**parameters:** number index<br> **parameters:** number index<br>
**returns:** self<br> **returns:** self<br>
## clear ## clear
clears the entire list (dropdown) clears the entire list (dropdown)
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show() local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show()
aDropdown:addItem("1. Entry") aDropdown:addItem("1. Entry")
aDropdown:addItem("2. Entry",colors.yellow) aDropdown:addItem("2. Entry",colors.yellow)
aDropdown:addItem("3. Entry",colors.yellow,colors.green) aDropdown:addItem("3. Entry",colors.yellow,colors.green)
aDropdown:clear() aDropdown:clear()
```` ```
**parameters:** -<br> **parameters:** -<br>
**returns:** self<br> **returns:** self<br>
## getItemIndex ## getItemIndex
returns the item index of the currently selected item returns the item index of the currently selected item
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show() local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show()
aDropdown:addItem("1. Entry") aDropdown:addItem("1. Entry")
aDropdown:addItem("2. Entry",colors.yellow) aDropdown:addItem("2. Entry",colors.yellow)
aDropdown:addItem("3. Entry",colors.yellow,colors.green) aDropdown:addItem("3. Entry",colors.yellow,colors.green)
aDropdown:getItemIndex() aDropdown:getItemIndex()
```` ```
**parameters:** -<br> **parameters:** -<br>
**returns:** number index<br> **returns:** number index<br>
## setSelectedItem ## setSelectedItem
Sets the background of the item which is currently selected Sets the background of the item which is currently selected
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show() local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show()
aDropdown:addItem("1. Entry") aDropdown:addItem("1. Entry")
aDropdown:addItem("2. Entry",colors.yellow) aDropdown:addItem("2. Entry",colors.yellow)
aDropdown:addItem("3. Entry",colors.yellow,colors.green) aDropdown:addItem("3. Entry",colors.yellow,colors.green)
aDropdown:setSelectedItem(colors.green, colors.blue) aDropdown:setSelectedItem(colors.green, colors.blue)
```` ```
**parameters:** number bgcolor, number fgcolor, boolean isActive (isActive means if different colors for selected item should be used)<br> **parameters:** number bgcolor, number fgcolor, boolean isActive (isActive means if different colors for selected item should be used)<br>
**returns:** self<br> **returns:** self<br>
## setOffset ## setOffset
sets the dropdown offset (will automatically change if scrolling is active) sets the dropdown offset (will automatically change if scrolling is active)
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show() local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show()
aDropdown:addItem("1. Entry") aDropdown:addItem("1. Entry")
aDropdown:addItem("2. Entry",colors.yellow) aDropdown:addItem("2. Entry",colors.yellow)
aDropdown:addItem("3. Entry",colors.yellow,colors.green) aDropdown:addItem("3. Entry",colors.yellow,colors.green)
aDropdown:setOffset(3) aDropdown:setOffset(3)
```` ```
**parameters:** number offsetValue<br> **parameters:** number offsetValue<br>
**returns:** self<br> **returns:** self<br>
## getOffset ## getOffset
returns the current offset returns the current offset
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show() local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show()
aDropdown:addItem("1. Entry") aDropdown:addItem("1. Entry")
aDropdown:addItem("2. Entry",colors.yellow) aDropdown:addItem("2. Entry",colors.yellow)
aDropdown:addItem("3. Entry",colors.yellow,colors.green) aDropdown:addItem("3. Entry",colors.yellow,colors.green)
aDropdown:getOffset() aDropdown:getOffset()
```` ```
**parameters:** -<br> **parameters:** -<br>
**returns:** number offsetValue<br> **returns:** number offsetValue<br>
## getOffset ## getOffset
returns the current offset returns the current offset
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show() local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show()
aDropdown:addItem("1. Entry") aDropdown:addItem("1. Entry")
aDropdown:addItem("2. Entry",colors.yellow) aDropdown:addItem("2. Entry",colors.yellow)
aDropdown:addItem("3. Entry",colors.yellow,colors.green) aDropdown:addItem("3. Entry",colors.yellow,colors.green)
aDropdown:getOffset() aDropdown:getOffset()
```` ```
**parameters:** -<br> **parameters:** -<br>
**returns:** number offsetValue<br> **returns:** number offsetValue<br>
## setDropdownSize ## setDropdownSize
sets the dropdown size (if you click on the button) sets the dropdown size (if you click on the button)
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show() local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show()
aDropdown:addItem("1. Entry") aDropdown:addItem("1. Entry")
aDropdown:addItem("2. Entry",colors.yellow) aDropdown:addItem("2. Entry",colors.yellow)
aDropdown:addItem("3. Entry",colors.yellow,colors.green) aDropdown:addItem("3. Entry",colors.yellow,colors.green)
aDropdown:setDropdownSize(12, 4) aDropdown:setDropdownSize(12, 4)
```` ```
**parameters:** number width, number height<br> **parameters:** number width, number height<br>
**returns:** self<br> **returns:** self<br>

View File

@@ -15,9 +15,9 @@ Creates a new non-parent frame - in most cases it is the first thing you'll need
#### Usage: #### Usage:
* Create a frame with an id "myFirstFrame", stored in a variable named frame * Create a frame with an id "myFirstFrame", stored in a variable named frame
````lua ```lua
local myFrame = basalt.createFrame("myFirstFrame") local myFrame = basalt.createFrame("myFirstFrame")
```` ```
## addFrame ## addFrame
Creates a child frame on the frame, the same as [basalt.createFrame](https://github.com/Pyroxenium/Basalt/wiki/Frame#basaltcreateframe) except the frames are given a parent-child relationship automatically Creates a child frame on the frame, the same as [basalt.createFrame](https://github.com/Pyroxenium/Basalt/wiki/Frame#basaltcreateframe) except the frames are given a parent-child relationship automatically
@@ -30,10 +30,10 @@ Creates a child frame on the frame, the same as [basalt.createFrame](https://git
#### Usage: #### Usage:
* Create a frame with id "myFirstFrame" then create a child of that frame, named "myFirstSubFrame" * Create a frame with id "myFirstFrame" then create a child of that frame, named "myFirstSubFrame"
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame") local mainFrame = basalt.createFrame("myFirstFrame")
local myFrame = mainFrame:addFrame("myFirstSubFrame") local myFrame = mainFrame:addFrame("myFirstSubFrame")
```` ```
## setBar ## setBar
Sets the text, background, and foreground of the upper bar of the frame, accordingly. Sets the text, background, and foreground of the upper bar of the frame, accordingly.
@@ -48,20 +48,20 @@ Sets the text, background, and foreground of the upper bar of the frame, accordi
#### Usage: #### Usage:
* Set the title to "My first frame!", with a background of gray and a foreground of light gray. * Set the title to "My first frame!", with a background of gray and a foreground of light gray.
````lua ```lua
frame:setBar("My first Frame!", colors.gray, colors.lightGray) frame:setBar("My first Frame!", colors.gray, colors.lightGray)
```` ```
* Store the frame, use the named frame variable after assigning. * Store the frame, use the named frame variable after assigning.
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame") local mainFrame = basalt.createFrame("myFirstFrame")
local myFrame = MainFrame:addFrame("myFirstSubFrame") local myFrame = MainFrame:addFrame("myFirstSubFrame")
myFrame:setBar("My first Frame!") myFrame:setBar("My first Frame!")
```` ```
* This abuses the call-chaining that Basalt uses. * This abuses the call-chaining that Basalt uses.
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame") local mainFrame = basalt.createFrame("myFirstFrame")
local myFrame = mainFrame:addFrame("myFirstSubFrame"):setBar("My first Frame!") local myFrame = mainFrame:addFrame("myFirstSubFrame"):setBar("My first Frame!")
```` ```
## setBarTextAlign ## setBarTextAlign
Sets the frame's bar-text alignment Sets the frame's bar-text alignment
@@ -72,9 +72,9 @@ Sets the frame's bar-text alignment
1. `frame` The frame being used 1. `frame` The frame being used
#### Usage: #### Usage:
* Set the title of myFrame to "My first frame!", and align it to the right. * Set the title of myFrame to "My first frame!", and align it to the right.
````lua ```lua
local mainFrame = myFrame:setBar("My first Frame!"):setBarTextAlign("right") local mainFrame = myFrame:setBar("My first Frame!"):setBarTextAlign("right")
```` ```
## showBar ## showBar
Toggles the frame's upper bar Toggles the frame's upper bar
@@ -84,9 +84,9 @@ Toggles the frame's upper bar
1. `frame` The frame being used 1. `frame` The frame being used
#### Usage: #### Usage:
* Sets myFrame to have a bar titled "Hello World!" and subsequently displays it. * Sets myFrame to have a bar titled "Hello World!" and subsequently displays it.
````lua ```lua
local mainFrame = myFrame:setBar("Hello World!"):showBar() local mainFrame = myFrame:setBar("Hello World!"):showBar()
```` ```
## addMonitor ## addMonitor
adds a monitor to the active main frame. adds a monitor to the active main frame.
@@ -96,12 +96,12 @@ adds a monitor to the active main frame.
1. `frame` returns a frame which you can use like normal frames 1. `frame` returns a frame which you can use like normal frames
#### Usage: #### Usage:
* Adds a monitor to the mainFrame. Only as long as this frame is also the active Frame, the monitor will be shown. * Adds a monitor to the mainFrame. Only as long as this frame is also the active Frame, the monitor will be shown.
````lua ```lua
local mainFrame = basalt.createFrame("mainFrame"):show() local mainFrame = basalt.createFrame("mainFrame"):show()
local monitor1 = mainFrame:addMonitor("right"):show() local monitor1 = mainFrame:addMonitor("right"):show()
monitor1:setBar("Monitor 1"):showBar() monitor1:setBar("Monitor 1"):showBar()
```` ```
## setMonitorScale ## setMonitorScale
changes the monitor scale (almost the same as setTextScale()) changes the monitor scale (almost the same as setTextScale())
@@ -111,12 +111,12 @@ changes the monitor scale (almost the same as setTextScale())
1. `monitor` The monitor being used 1. `monitor` The monitor being used
#### Usage: #### Usage:
* Changes the monitor scale to 2 * Changes the monitor scale to 2
````lua ```lua
local mainFrame = basalt.createFrame("mainFrame"):show() local mainFrame = basalt.createFrame("mainFrame"):show()
local monitor1 = mainFrame:addMonitor("right"):setMonitorScale(2):show() local monitor1 = mainFrame:addMonitor("right"):setMonitorScale(2):show()
monitor1:setBar("Monitor 1"):showBar() monitor1:setBar("Monitor 1"):showBar()
```` ```
## ~~isModifierActive~~ ## ~~isModifierActive~~
### _Disabled, this function is a WIP_ ### _Disabled, this function is a WIP_
@@ -128,11 +128,11 @@ Returns true if the user is currently holding the respective key down
1. `boolean` - Whether the user is holding the key down 1. `boolean` - Whether the user is holding the key down
#### Usage: #### Usage:
* Checks if the "shift" modifier is active on the myFrame frame * Checks if the "shift" modifier is active on the myFrame frame
````lua ```lua
local isActive = myFrame:isModifierActive("shift") local isActive = myFrame:isModifierActive("shift")
```` ```
* Creates a label, changing the text to "Shift is inactive oh no :(" and "Shift is active yay!", accordingly. * Creates a label, changing the text to "Shift is inactive oh no :(" and "Shift is active yay!", accordingly.
````lua ```lua
local aLabel = myFrame:addLabel("myFirstLabel"):setText("Shift is inactive oh no :(") local aLabel = myFrame:addLabel("myFirstLabel"):setText("Shift is inactive oh no :(")
myFrame:addButton("myFirstButton"):setText("Click"):onClick( myFrame:addButton("myFirstButton"):setText("Click"):onClick(
function() function()
@@ -143,7 +143,7 @@ myFrame:addButton("myFirstButton"):setText("Click"):onClick(
end end
end end
) )
```` ```
## getObject ## getObject
Returns a child object of the frame Returns a child object of the frame
@@ -154,10 +154,10 @@ Returns a child object of the frame
1. `object | nil` The object with the supplied name, or `nil` if there is no object present with the given name 1. `object | nil` The object with the supplied name, or `nil` if there is no object present with the given name
#### Usage: #### Usage:
* Adds a button with id "myFirstButton", then retrieves it again through the frame object * Adds a button with id "myFirstButton", then retrieves it again through the frame object
````lua ```lua
myFrame:addButton("myFirstButton") myFrame:addButton("myFirstButton")
local aButton = myFrame:getObject("myFirstButton") local aButton = myFrame:getObject("myFirstButton")
```` ```
## removeObject ## removeObject
Removes a child object from the frame Removes a child object from the frame
@@ -167,10 +167,10 @@ Removes a child object from the frame
1. `boolean` Whether the object with the given name was properly removed 1. `boolean` Whether the object with the given name was properly removed
#### Usage: #### Usage:
* Adds a button with the id "myFirstButton", then removes it with the aforementioned id * Adds a button with the id "myFirstButton", then removes it with the aforementioned id
````lua ```lua
myFrame:addButton("myFirstButton") myFrame:addButton("myFirstButton")
myFrame:removeObject("myFirstButton") myFrame:removeObject("myFirstButton")
```` ```
## setFocusedObject ## setFocusedObject
Sets the currently focused object Sets the currently focused object
@@ -181,10 +181,10 @@ Sets the currently focused object
1. `frame` The frame being used 1. `frame` The frame being used
#### Usage: #### Usage:
* Creates button with id "myFirstButton", sets the focused object to the previously mentioned button * Creates button with id "myFirstButton", sets the focused object to the previously mentioned button
````lua ```lua
local aButton = myFrame:addButton("myFirstButton") local aButton = myFrame:addButton("myFirstButton")
myFrame:setFocusedObject(aButton) myFrame:setFocusedObject(aButton)
```` ```
## removeFocusedObject ## removeFocusedObject
Removes the focus of the supplied object Removes the focus of the supplied object
#### Parameters: #### Parameters:
@@ -193,10 +193,10 @@ Removes the focus of the supplied object
1. `frame` The frame being used 1. `frame` The frame being used
#### Usage: #### Usage:
* Creates a button with id "myFirstButton", then removes the focus from that button * Creates a button with id "myFirstButton", then removes the focus from that button
````lua ```lua
local aButton = myFrame:addButton("myFirstButton") local aButton = myFrame:addButton("myFirstButton")
myFrame:removeFocusedObject(aButton) myFrame:removeFocusedObject(aButton)
```` ```
## getFocusedObject ## getFocusedObject
Gets the currently focused object Gets the currently focused object
@@ -205,9 +205,9 @@ Gets the currently focused object
1. `object` The currently focused object 1. `object` The currently focused object
#### Usage: #### Usage:
* Gets the currently focused object from the frame, storing it in a variable * Gets the currently focused object from the frame, storing it in a variable
````lua ```lua
local focusedObject = myFrame:getFocusedObject() local focusedObject = myFrame:getFocusedObject()
```` ```
## setMovable ## setMovable
Sets whether the frame can be moved. _In order to move the frame click and drag the upper bar of the frame_ Sets whether the frame can be moved. _In order to move the frame click and drag the upper bar of the frame_
@@ -217,9 +217,9 @@ Sets whether the frame can be moved. _In order to move the frame click and drag
1. `frame` The frame being used 1. `frame` The frame being used
#### Usage: #### Usage:
* Creates a frame with id "myFirstFrame" and makes it movable * Creates a frame with id "myFirstFrame" and makes it movable
````lua ```lua
local myFrame = basalt.createFrame("myFirstFrame"):setMovable(true) local myFrame = basalt.createFrame("myFirstFrame"):setMovable(true)
```` ```
## ~~setMoveable~~ ## ~~setMoveable~~
### _Deprecated in favor of setMovable_ ### _Deprecated in favor of setMovable_
@@ -231,9 +231,9 @@ Sets whether the frame can be moved. _In order to move the frame use the upper b
1. `frame` The frame being used 1. `frame` The frame being used
#### Usage: #### Usage:
* Creates a frame with id "myFirstFrame" and makes it movable * Creates a frame with id "myFirstFrame" and makes it movable
````lua ```lua
local myFrame = basalt.createFrame("myFirstFrame"):setMoveable(true) local myFrame = basalt.createFrame("myFirstFrame"):setMoveable(true)
```` ```
## setOffset ## setOffset
Sets the frame's coordinate offset. The frame's child objects will receive the frame's coordinate offset. For example, when using the scrollbar, if you use its value to add an offset to a frame, you will get a scrollable frame. Sets the frame's coordinate offset. The frame's child objects will receive the frame's coordinate offset. For example, when using the scrollbar, if you use its value to add an offset to a frame, you will get a scrollable frame.
@@ -248,10 +248,10 @@ The function can be supplied negative offsets
1. `frame` The frame being used 1. `frame` The frame being used
#### Usage: #### Usage:
* Creates "myFirstFrame" with an x offset of 5 and a y offset of 3 * Creates "myFirstFrame" with an x offset of 5 and a y offset of 3
````lua ```lua
local myFrame = basalt.createFrame("myFirstFrame"):setOffset(5, 3) local myFrame = basalt.createFrame("myFirstFrame"):setOffset(5, 3)
```` ```
* Creates "myFirstFrame" with an x offset of 5 and a y offset of -5 (Meaning if you added a button with y position 5, it would be at y position 0) * Creates "myFirstFrame" with an x offset of 5 and a y offset of -5 (Meaning if you added a button with y position 5, it would be at y position 0)
````lua ```lua
local myFrame = basalt.createFrame("myFirstFrame"):setOffset(5, -5) local myFrame = basalt.createFrame("myFirstFrame"):setOffset(5, -5)
```` ```

View File

@@ -7,30 +7,30 @@ Remember Image inherits from [Object](objects/Object.md)
## loadImage ## loadImage
loads a image into the memory. loads a image into the memory.
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aImage = mainFrame:addImage("myFirstImage"):loadImage("randomImage.nfp"):show() local aImage = mainFrame:addImage("myFirstImage"):loadImage("randomImage.nfp"):show()
```` ```
**Arguments:** string path<br> **Arguments:** string path<br>
**returns:** self<br> **returns:** self<br>
## loadBlittleImage -- not finished yet ## loadBlittleImage -- not finished yet
loads a blittle image into the memory. loads a blittle image into the memory.
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aImage = mainFrame:addImage("myFirstImage"):loadBlittleImage("blittleImage.blt"):show() local aImage = mainFrame:addImage("myFirstImage"):loadBlittleImage("blittleImage.blt"):show()
```` ```
**Arguments:** string path<br> **Arguments:** string path<br>
**returns:** self<br> **returns:** self<br>
## shrink ## shrink
If you were loading a normal (paint) image into the memory, this function would shrink it to a If you were loading a normal (paint) image into the memory, this function would shrink it to a
blittle image and immediatly draws it (if it's visible) blittle image and immediatly draws it (if it's visible)
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aImage = mainFrame:addImage("myFirstImage"):loadBlittleImage("randomImage.nfp"):shrink():show() local aImage = mainFrame:addImage("myFirstImage"):loadBlittleImage("randomImage.nfp"):shrink():show()
```` ```
**Arguments:** -<br> **Arguments:** -<br>
**returns:** self<br> **returns:** self<br>

View File

@@ -5,9 +5,9 @@ Remember Input inherits from [Object](objects/Object.md)
## setInputType ## setInputType
changes the input type changes the input type
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aInput = mainFrame:addInput("myFirstInput"):setInputType("password"):show() local aInput = mainFrame:addInput("myFirstInput"):setInputType("password"):show()
```` ```
**parameters:** string value ("text", "password", "number")<br> **parameters:** string value ("text", "password", "number")<br>
**returns:** self<br> **returns:** self<br>

View File

@@ -3,7 +3,7 @@ This is just a script which helps you to install basalt.lua, if it's not already
## Visual Installer ## Visual Installer
This is a visual version, it asks the user if he wants to install basalt.lua (if not found)<br> This is a visual version, it asks the user if he wants to install basalt.lua (if not found)<br>
![](https://i.imgur.com/b4Ys7FB.png) ![](https://i.imgur.com/b4Ys7FB.png)
````lua ```lua
--Basalt configurated installer --Basalt configurated installer
local filePath = "basalt.lua" --here you can change the file path default: basalt.lua local filePath = "basalt.lua" --here you can change the file path default: basalt.lua
if not(fs.exists(filePath))then if not(fs.exists(filePath))then
@@ -58,11 +58,11 @@ end
local basalt = dofile(filePath) -- here you can change the variablename in any variablename you want default: basalt local basalt = dofile(filePath) -- here you can change the variablename in any variablename you want default: basalt
------------------------------ ------------------------------
```` ```
## Basic Installer ## Basic Installer
Here is a very basic one which just installs basalt.lua if don't exist: Here is a very basic one which just installs basalt.lua if don't exist:
````lua ```lua
--Basalt configurated installer --Basalt configurated installer
local filePath = "basalt.lua" --here you can change the file path default: basalt.lua local filePath = "basalt.lua" --here you can change the file path default: basalt.lua
if not(fs.exists(filePath))then if not(fs.exists(filePath))then
@@ -70,4 +70,4 @@ shell.run("pastebin run ESs1mg7P")
end end
local basalt = dofile(filePath) -- here you can change the variablename in any variablename you want default: basalt local basalt = dofile(filePath) -- here you can change the variablename in any variablename you want default: basalt
```` ```

View File

@@ -7,28 +7,28 @@ Remember Label inherits from [Object](objects/Object.md)
## setText ## setText
sets the text which gets displayed. sets the text which gets displayed.
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aInput = mainFrame:addLabel("myFirstLabel"):setText("Hello lovely basalt community!"):show() local aInput = mainFrame:addLabel("myFirstLabel"):setText("Hello lovely basalt community!"):show()
```` ```
**arguments:** string text<br> **arguments:** string text<br>
**returns:** self<br> **returns:** self<br>
## setFontSize ## setFontSize
sets the font size of that text. sets the font size of that text.
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aInput = mainFrame:addLabel("myFirstLabel"):setText("Hello"):setFontSize(2):show() local aInput = mainFrame:addLabel("myFirstLabel"):setText("Hello"):setFontSize(2):show()
```` ```
**arguments:** number size (1 = default, 2 = big, 3 = bigger, 4 = huge)<br> **arguments:** number size (1 = default, 2 = big, 3 = bigger, 4 = huge)<br>
**returns:** self<br> **returns:** self<br>
## getFontSize ## getFontSize
returns the fontsize returns the fontsize
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aInput = mainFrame:addLabel("myFirstLabel"):setText("Hello"):setFontSize(2):show() local aInput = mainFrame:addLabel("myFirstLabel"):setText("Hello"):setFontSize(2):show()
basalt.debug(aInput:getFontSize()) -- returns 2 basalt.debug(aInput:getFontSize()) -- returns 2
```` ```
**arguments:** <br> **arguments:** <br>
**returns:** number<br> **returns:** number<br>

View File

@@ -2,10 +2,10 @@ Lists are objects where you can create endless entrys and the user can choose on
Here is a example of how to create a standard list: Here is a example of how to create a standard list:
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aList = mainFrame:addList("myFirstList"):show() local aList = mainFrame:addList("myFirstList"):show()
```` ```
This will create a default list with the size 8 width and 5 height on position 1 1 (relative to its parent frame), the default background is colors.lightGray, the default text color is colors.black and the default zIndex is 5. The default horizontal text align is "center", default symbol is ">" This will create a default list with the size 8 width and 5 height on position 1 1 (relative to its parent frame), the default background is colors.lightGray, the default text color is colors.black and the default zIndex is 5. The default horizontal text align is "center", default symbol is ">"
@@ -14,138 +14,138 @@ Here are all possible functions available for lists. Remember List inherits from
## addItem ## addItem
Adds a item into the list Adds a item into the list
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aList = mainFrame:addList("myFirstList"):show() local aList = mainFrame:addList("myFirstList"):show()
aList:addItem("1. Entry") aList:addItem("1. Entry")
aList:addItem("2. Entry",colors.yellow) aList:addItem("2. Entry",colors.yellow)
aList:addItem("3. Entry",colors.yellow,colors.green) aList:addItem("3. Entry",colors.yellow,colors.green)
```` ```
**parameters:** string text, number bgcolor, number fgcolor, any ... - (text is the displayed text, bgcolor and fgcolors the colors of background/text and args (...) is something dynamic, you wont see them but if you require some more information per item you can use that)<br> **parameters:** string text, number bgcolor, number fgcolor, any ... - (text is the displayed text, bgcolor and fgcolors the colors of background/text and args (...) is something dynamic, you wont see them but if you require some more information per item you can use that)<br>
**returns:** self<br> **returns:** self<br>
## removeItem ## removeItem
Removes a item from the list Removes a item from the list
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aList = mainFrame:addList("myFirstList"):show() local aList = mainFrame:addList("myFirstList"):show()
aList:addItem("1. Entry") aList:addItem("1. Entry")
aList:addItem("2. Entry",colors.yellow) aList:addItem("2. Entry",colors.yellow)
aList:addItem("3. Entry",colors.yellow,colors.green) aList:addItem("3. Entry",colors.yellow,colors.green)
aList:removeItem(2) aList:removeItem(2)
```` ```
**parameters:** number index<br> **parameters:** number index<br>
**returns:** self<br> **returns:** self<br>
## editItem ## editItem
Edits a item on the list Edits a item on the list
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aList = mainFrame:addList("myFirstList"):show() local aList = mainFrame:addList("myFirstList"):show()
aList:addItem("1. Entry") aList:addItem("1. Entry")
aList:addItem("2. Entry",colors.yellow) aList:addItem("2. Entry",colors.yellow)
aList:addItem("3. Entry",colors.yellow,colors.green) aList:addItem("3. Entry",colors.yellow,colors.green)
aList:editItem(3,"3. Edited Entry",colors.yellow,colors.green) aList:editItem(3,"3. Edited Entry",colors.yellow,colors.green)
```` ```
**parameters:** number index, string text, number bgcolor, number fgcolor, any ...<br> **parameters:** number index, string text, number bgcolor, number fgcolor, any ...<br>
**returns:** self<br> **returns:** self<br>
## setScrollable ## setScrollable
Makes the list scrollable Makes the list scrollable
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aList = mainFrame:addList("myFirstList"):show() local aList = mainFrame:addList("myFirstList"):show()
aList:addItem("1. Entry") aList:addItem("1. Entry")
aList:addItem("2. Entry",colors.yellow) aList:addItem("2. Entry",colors.yellow)
aList:addItem("3. Entry",colors.yellow,colors.green) aList:addItem("3. Entry",colors.yellow,colors.green)
aList:setScrollable(true) aList:setScrollable(true)
```` ```
**parameters:** boolean isScrollable<br> **parameters:** boolean isScrollable<br>
**returns:** self<br> **returns:** self<br>
## selectItem ## selectItem
selects a item in the list (same as a player would click on a item) selects a item in the list (same as a player would click on a item)
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aList = mainFrame:addList("myFirstList"):show() local aList = mainFrame:addList("myFirstList"):show()
aList:addItem("1. Entry") aList:addItem("1. Entry")
aList:addItem("2. Entry",colors.yellow) aList:addItem("2. Entry",colors.yellow)
aList:addItem("3. Entry",colors.yellow,colors.green) aList:addItem("3. Entry",colors.yellow,colors.green)
aList:selectItem(1) aList:selectItem(1)
```` ```
**parameters:** number index<br> **parameters:** number index<br>
**returns:** self<br> **returns:** self<br>
## clear ## clear
clears the entire list clears the entire list
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show() local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show()
aDropdown:addItem("1. Entry") aDropdown:addItem("1. Entry")
aDropdown:addItem("2. Entry",colors.yellow) aDropdown:addItem("2. Entry",colors.yellow)
aDropdown:addItem("3. Entry",colors.yellow,colors.green) aDropdown:addItem("3. Entry",colors.yellow,colors.green)
aDropdown:clear() aDropdown:clear()
```` ```
**parameters:** -<br> **parameters:** -<br>
**returns:** self<br> **returns:** self<br>
## getItemIndex ## getItemIndex
returns the item index of the currently selected item returns the item index of the currently selected item
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show() local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show()
aDropdown:addItem("1. Entry") aDropdown:addItem("1. Entry")
aDropdown:addItem("2. Entry",colors.yellow) aDropdown:addItem("2. Entry",colors.yellow)
aDropdown:addItem("3. Entry",colors.yellow,colors.green) aDropdown:addItem("3. Entry",colors.yellow,colors.green)
aDropdown:getItemIndex() aDropdown:getItemIndex()
```` ```
**parameters:** -<br> **parameters:** -<br>
**returns:** number index<br> **returns:** number index<br>
## setSelectedItem ## setSelectedItem
Sets the background of the item which is currently selected Sets the background of the item which is currently selected
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aList = mainFrame:addList("myFirstList"):show() local aList = mainFrame:addList("myFirstList"):show()
aList:addItem("1. Entry") aList:addItem("1. Entry")
aList:addItem("2. Entry",colors.yellow) aList:addItem("2. Entry",colors.yellow)
aList:addItem("3. Entry",colors.yellow,colors.green) aList:addItem("3. Entry",colors.yellow,colors.green)
aList:setSelectedItem(colors.green, colors.blue) aList:setSelectedItem(colors.green, colors.blue)
```` ```
**parameters:** number bgcolor, number fgcolor, boolean isActive (isActive means if different colors for selected item should be used)<br> **parameters:** number bgcolor, number fgcolor, boolean isActive (isActive means if different colors for selected item should be used)<br>
**returns:** self<br> **returns:** self<br>
## setOffset ## setOffset
sets the list offset (will automatically change if scrolling is active) sets the list offset (will automatically change if scrolling is active)
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aList = mainFrame:addList("myFirstList"):show() local aList = mainFrame:addList("myFirstList"):show()
aList:addItem("1. Entry") aList:addItem("1. Entry")
aList:addItem("2. Entry",colors.yellow) aList:addItem("2. Entry",colors.yellow)
aList:addItem("3. Entry",colors.yellow,colors.green) aList:addItem("3. Entry",colors.yellow,colors.green)
aList:setOffset(3) aList:setOffset(3)
```` ```
**parameters:** number offsetValue<br> **parameters:** number offsetValue<br>
**returns:** self<br> **returns:** self<br>
## getOffset ## getOffset
returns the current offset returns the current offset
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aList = mainFrame:addList("myFirstList"):show() local aList = mainFrame:addList("myFirstList"):show()
aList:addItem("1. Entry") aList:addItem("1. Entry")
aList:addItem("2. Entry",colors.yellow) aList:addItem("2. Entry",colors.yellow)
aList:addItem("3. Entry",colors.yellow,colors.green) aList:addItem("3. Entry",colors.yellow,colors.green)
aList:getOffset() aList:getOffset()
```` ```
**parameters:** -<br> **parameters:** -<br>
**returns:** number offsetValue<br> **returns:** number offsetValue<br>

View File

@@ -2,29 +2,29 @@ This is the base class of all visual objects. This means, if you create a button
## show ## show
shows the object (only if the parent frame is already visible) shows the object (only if the parent frame is already visible)
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local button = mainFrame:addButton("myFirstButton") local button = mainFrame:addButton("myFirstButton")
button:show() button:show()
```` ```
**parameters:** -<br> **parameters:** -<br>
**returns:** self<br> **returns:** self<br>
## hide ## hide
hides the object hides the object
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() 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()
```` ```
**parameters:** -<br> **parameters:** -<br>
**returns:** self<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)
```` ```
**parameters:** number x, number y[, boolean relative], if relative is set to true it will add/remove instead of set x, y<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:** self<br> **returns:** self<br>
@@ -32,25 +32,25 @@ local mainFrame = basalt.createFrame("myFirstFrame"):setPosition(2,3)
## setBackground ## setBackground
Changes the object background color Changes the object background color
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):setBackground(colors.lightGray) local mainFrame = basalt.createFrame("myFirstFrame"):setBackground(colors.lightGray)
```` ```
**parameters:** number color<br> **parameters:** number color<br>
**returns:** self<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)
```` ```
**parameters:** number color<br> **parameters:** number color<br>
**returns:** self<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)
```` ```
**parameters:** number width, number length<br> **parameters:** number width, number length<br>
**returns:** self<br> **returns:** self<br>
@@ -58,128 +58,128 @@ local mainFrame = basalt.createFrame("myFirstFrame"):setSize(15,5)
sets the object to be the focused object. sets the object to be the focused object.
If you click on a object, it's normaly automatically the focused object. As example, if you :show() a frame and you want this particular frame to be in If you click on a object, it's normaly automatically the focused object. As example, if you :show() a frame and you want this particular frame to be in
the foreground, you have to use :setFocus() the foreground, you have to use :setFocus()
````lua ```lua
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()
```` ```
**parameters:** -<br> **parameters:** -<br>
**returns:** self<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.
````lua ```lua
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()
```` ```
**parameters:** number index<br> **parameters:** number index<br>
**returns:** self<br> **returns:** self<br>
## setParent ## setParent
changes the frame parent of that object changes the frame parent of that object
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() 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()
```` ```
**parameters:** frame object<br> **parameters:** frame object<br>
**returns:** self<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
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() 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
```` ```
**parameters:** -<br> **parameters:** -<br>
**returns:** boolean<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
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):setSize(15,15):show() 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
```` ```
**parameters:** number x, number y - or nothing (if nothing it uses the object's x, y)<br> **parameters:** number x, number y - or nothing (if nothing it uses the object's x, y)<br>
**returns:** number x, number y (converted)<br> **returns:** number x, number y (converted)<br>
## setAnchor ## setAnchor
sets the anchor of that object sets the anchor of that object
````lua ```lua
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()
```` ```
**parameters:** string sides - ("left", "right", "top", "bottom") you can stack positions like so ..:setAnchor("right", "bottom")<br> **parameters:** string sides - ("left", "right", "top", "bottom") you can stack positions like so ..:setAnchor("right", "bottom")<br>
**returns:** self<br> **returns:** self<br>
## getAbsolutePosition ## getAbsolutePosition
converts the relative coordinates into absolute coordinates converts the relative coordinates into absolute coordinates
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):setPosition(3,3):show() 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
```` ```
**parameters:** number x, number y - or nothing (if nothing it uses the object's x, y)<br> **parameters:** number x, number y - or nothing (if nothing it uses the object's x, y)<br>
**returns:** self<br> **returns:** self<br>
## setTextAlign ## setTextAlign
sets the text align of the object (for example buttons) sets the text align of the object (for example buttons)
````lua ```lua
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()
```` ```
**parameters:** string horizontal, string vertical - ("left", "center", "right")<br> **parameters:** string horizontal, string vertical - ("left", "center", "right")<br>
**returns:** self<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,...)
````lua ```lua
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()
```` ```
**parameters:** any value<br> **parameters:** any value<br>
**returns:** self<br> **returns:** self<br>
## getValue ## getValue
returns the currently saved value returns the currently saved value
````lua ```lua
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()
basalt.debug(aCheckbox:getValue()) -- returns true basalt.debug(aCheckbox:getValue()) -- returns true
```` ```
**parameters:**-<br> **parameters:**-<br>
**returns:** any value<br> **returns:** any value<br>
## getHeight/getWidth ## getHeight/getWidth
returns the height or width 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
```` ```
**parameters:**-<br> **parameters:**-<br>
**returns:** number height/width<br> **returns:** number height/width<br>
## isVisible ## isVisible
returns if the object is currently visible returns if the object is currently visible
````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:isVisible()) -- returns true basalt.debug(aButton:isVisible()) -- returns true
```` ```
**parameters:**-<br> **parameters:**-<br>
**returns:** boolean<br> **returns:** boolean<br>
## getName ## getName
returns the given name of that object returns the given name of that object
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
basalt.debug(mainFrame:getName()) -- returns myFirstFrame basalt.debug(mainFrame:getName()) -- returns myFirstFrame
```` ```
**parameters:**-<br> **parameters:**-<br>
**returns:** string name<br> **returns:** string name<br>
@@ -188,60 +188,60 @@ These object events are available for all objects, if a object got some unique e
## onClick ## onClick
creates a mouse_click event creates a mouse_click event
````lua ```lua
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()
```` ```
**parameters:** function func<br> **parameters:** function func<br>
**returns:** self<br> **returns:** self<br>
## onClickUp ## onClickUp
creates a click_up event creates a click_up event
````lua ```lua
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()
```` ```
**parameters:** function func<br> **parameters:** function func<br>
**returns:** self<br> **returns:** self<br>
## onMouseDrag ## onMouseDrag
creates a mouse_drag event creates a mouse_drag event
````lua ```lua
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()
```` ```
**parameters:** function func<br> **parameters:** function func<br>
**returns:** self<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)
````lua ```lua
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()
```` ```
**parameters:** function func<br> **parameters:** function func<br>
**returns:** self<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()
```` ```
**parameters:** function func<br> **parameters:** function func<br>
**returns:** self<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()
```` ```
**parameters:** function func<br> **parameters:** function func<br>
**returns:** self<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()
```` ```
**parameters:** function func<br> **parameters:** function func<br>
**returns:** self<br> **returns:** self<br>

View File

@@ -7,10 +7,10 @@ Pane doesn't have any custom functionallity. If you want to change the color/pos
## Example: ## Example:
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aPane = mainFrame:addPane("myFirstBackground") local aPane = mainFrame:addPane("myFirstBackground")
aPane:setSize(30, 10) aPane:setSize(30, 10)
aPane:setBackground(colors.yellow) aPane:setBackground(colors.yellow)
aPane:show() aPane:show()
```` ```

View File

@@ -5,99 +5,99 @@ Remember Program inherits from [Object](objects/Object.md)
## getStatus ## getStatus
returns the current status returns the current status
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aProgram = mainFrame:addProgram("myFirstProgram"):show() local aProgram = mainFrame:addProgram("myFirstProgram"):show()
basalt.debug(aProgram:getStatus()) -- returns "running", "normal", "suspended" or "dead" basalt.debug(aProgram:getStatus()) -- returns "running", "normal", "suspended" or "dead"
```` ```
**parameters:**-<br> **parameters:**-<br>
**returns:** string "running" - if its running, "normal" - is active but not running (waiting for a event), "suspended" - is suspended or not started, "dead" - has finished or stopped with an error<br> **returns:** string "running" - if its running, "normal" - is active but not running (waiting for a event), "suspended" - is suspended or not started, "dead" - has finished or stopped with an error<br>
## execute ## execute
executes the given path (-program) executes the given path (-program)
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aProgram = mainFrame:addProgram("myFirstProgram"):show() local aProgram = mainFrame:addProgram("myFirstProgram"):show()
aProgram:execute("rom/programs/fun/worm.lua") -- executes worm aProgram:execute("rom/programs/fun/worm.lua") -- executes worm
```` ```
**parameters:** string filepath - (the path to the program you want to execute)<br> **parameters:** string filepath - (the path to the program you want to execute)<br>
**returns:** self<br> **returns:** self<br>
## stop ## stop
gives a terminate event to the program, which means if you are running a shell, and the shell executes a program by itself you have to call stop 2 times to entirely close the running program gives a terminate event to the program, which means if you are running a shell, and the shell executes a program by itself you have to call stop 2 times to entirely close the running program
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aProgram = mainFrame:addProgram("myFirstProgram"):execute("rom/programs/shell.lua"):show() local aProgram = mainFrame:addProgram("myFirstProgram"):execute("rom/programs/shell.lua"):show()
mainFrame:addButton("myFirstButton"):setText("close"):onClick(function() aProgram:stop() end):show() mainFrame:addButton("myFirstButton"):setText("close"):onClick(function() aProgram:stop() end):show()
```` ```
**parameters:**-<br> **parameters:**-<br>
**returns:** self<br> **returns:** self<br>
## pause ## pause
pauses the program (prevents the program from receiving events) pauses the program (prevents the program from receiving events)
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aProgram = mainFrame:addProgram("myFirstProgram"):execute("rom/programs/shell.lua"):show() local aProgram = mainFrame:addProgram("myFirstProgram"):execute("rom/programs/shell.lua"):show()
mainFrame:addButton("myFirstButton"):setText("close"):onClick(function() aProgram:pause(true) end):show() mainFrame:addButton("myFirstButton"):setText("close"):onClick(function() aProgram:pause(true) end):show()
```` ```
**parameters:** boolean pause<br> **parameters:** boolean pause<br>
**returns:** self<br> **returns:** self<br>
## isPaused ## isPaused
returns if the program is currently paused returns if the program is currently paused
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aProgram = mainFrame:addProgram("myFirstProgram"):execute("rom/programs/shell.lua"):show() local aProgram = mainFrame:addProgram("myFirstProgram"):execute("rom/programs/shell.lua"):show()
mainFrame:addButton("myFirstButton"):setText("pause"):onClick(function() basalt.debug(aProgram:isPaused()) end):show() mainFrame:addButton("myFirstButton"):setText("pause"):onClick(function() basalt.debug(aProgram:isPaused()) end):show()
```` ```
**parameters:** -<br> **parameters:** -<br>
**returns:** boolean isPaused<br> **returns:** boolean isPaused<br>
## injectEvent ## injectEvent
injects a event into the program manually injects a event into the program manually
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aProgram = mainFrame:addProgram("myFirstProgram"):execute("rom/programs/shell.lua"):show() local aProgram = mainFrame:addProgram("myFirstProgram"):execute("rom/programs/shell.lua"):show()
mainFrame:addButton("myFirstButton"):setText("inject"):onClick(function() aProgram:injectEvent("char", "w") end):show() mainFrame:addButton("myFirstButton"):setText("inject"):onClick(function() aProgram:injectEvent("char", "w") end):show()
```` ```
**parameters:** string event, any parameter, any parameter, any parameter, any parameter, boolean ignorePause<br> **parameters:** string event, any parameter, any parameter, any parameter, any parameter, boolean ignorePause<br>
**returns:** self<br> **returns:** self<br>
## injectEvents ## injectEvents
injects a event table into the program manually injects a event table into the program manually
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aProgram = mainFrame:addProgram("myFirstProgram"):execute("rom/programs/shell.lua"):show() local aProgram = mainFrame:addProgram("myFirstProgram"):execute("rom/programs/shell.lua"):show()
--example will follow --example will follow
```` ```
**parameters:** string event, any parameter, any parameter, any parameter, any parameter, boolean ignorePause<br> **parameters:** string event, any parameter, any parameter, any parameter, any parameter, boolean ignorePause<br>
**returns:** self<br> **returns:** self<br>
## getQueuedEvents ## getQueuedEvents
returns a table of all currently queued events (while pause is active incomming events will go into a queueEvents table) as soon as the program gets unpaused returns a table of all currently queued events (while pause is active incomming events will go into a queueEvents table) as soon as the program gets unpaused
it will inject these events it will inject these events
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aProgram = mainFrame:addProgram("myFirstProgram"):execute("rom/programs/shell.lua"):show() local aProgram = mainFrame:addProgram("myFirstProgram"):execute("rom/programs/shell.lua"):show()
mainFrame:addButton("myFirstButton"):setText("inject"):onClick(function() basalt.debug(aProgram:getQueuedEvents()) end):show() mainFrame:addButton("myFirstButton"):setText("inject"):onClick(function() basalt.debug(aProgram:getQueuedEvents()) end):show()
```` ```
**parameters:** -<br> **parameters:** -<br>
**returns:** table queuedEvents<br> **returns:** table queuedEvents<br>
## updateQueuedEvents ## updateQueuedEvents
here you can manipulate the queuedEvents table with your own events table here you can manipulate the queuedEvents table with your own events table
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aProgram = mainFrame:addProgram("myFirstProgram"):execute("rom/programs/shell.lua"):show() local aProgram = mainFrame:addProgram("myFirstProgram"):execute("rom/programs/shell.lua"):show()
--example will follow --example will follow
```` ```
**parameters:** table queuedEvents<br> **parameters:** table queuedEvents<br>
**returns:** self<br> **returns:** self<br>

View File

@@ -2,10 +2,10 @@ Radios are objects where you can create endless entrys the user can click on a b
Here is an example of how to create a standard radio: Here is an example of how to create a standard radio:
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aRadio = mainFrame:addRadio("myFirstRadio"):show() local aRadio = mainFrame:addRadio("myFirstRadio"):show()
```` ```
Here are all possible functions available for radios: <br> Here are all possible functions available for radios: <br>
Remember Radio inherits from [Object](objects/Object.md) Remember Radio inherits from [Object](objects/Object.md)
@@ -13,110 +13,110 @@ Remember Radio inherits from [Object](objects/Object.md)
## addItem ## addItem
Adds a item to the radio Adds a item to the radio
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aRadio = mainFrame:addRadio("myFirstRadio"):show() local aRadio = mainFrame:addRadio("myFirstRadio"):show()
aRadio:addItem("1. Entry",3,4) aRadio:addItem("1. Entry",3,4)
aRadio:addItem("2. Entry",3,5,colors.yellow) aRadio:addItem("2. Entry",3,5,colors.yellow)
aRadio:addItem("3. Entry",3,6,colors.yellow,colors.green) aRadio:addItem("3. Entry",3,6,colors.yellow,colors.green)
```` ```
**parameters:** string text, number x, number y, number bgcolor, number fgcolor, any ... - (text is the displayed text, bgcolor and fgcolors the colors of background/text and args (...) is something dynamic, you wont see them but if you require some more information per item you can use that)<br> **parameters:** string text, number x, number y, number bgcolor, number fgcolor, any ... - (text is the displayed text, bgcolor and fgcolors the colors of background/text and args (...) is something dynamic, you wont see them but if you require some more information per item you can use that)<br>
**returns:** self<br> **returns:** self<br>
## removeItem ## removeItem
Removes a item from the radio Removes a item from the radio
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aRadio = mainFrame:addRadio("myFirstRadio"):show() local aRadio = mainFrame:addRadio("myFirstRadio"):show()
aRadio:addItem("1. Entry",3,4) aRadio:addItem("1. Entry",3,4)
aRadio:addItem("2. Entry",3,5,colors.yellow) aRadio:addItem("2. Entry",3,5,colors.yellow)
aRadio:addItem("3. Entry",3,6,colors.yellow,colors.green) aRadio:addItem("3. Entry",3,6,colors.yellow,colors.green)
aRadio:removeItem(2) aRadio:removeItem(2)
```` ```
**parameters:** number index<br> **parameters:** number index<br>
**returns:** self<br> **returns:** self<br>
## editItem ## editItem
Edits a item on the radio Edits a item on the radio
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aRadio = mainFrame:addRadio("myFirstRadio"):show() local aRadio = mainFrame:addRadio("myFirstRadio"):show()
aRadio:addItem("1. Entry",3,4) aRadio:addItem("1. Entry",3,4)
aRadio:addItem("2. Entry",3,5,colors.yellow) aRadio:addItem("2. Entry",3,5,colors.yellow)
aRadio:addItem("3. Entry",3,6,colors.yellow,colors.green) aRadio:addItem("3. Entry",3,6,colors.yellow,colors.green)
aRadio:editItem(3,"3. Edited Entry",3,6,colors.yellow,colors.green) aRadio:editItem(3,"3. Edited Entry",3,6,colors.yellow,colors.green)
```` ```
**parameters:** number index, string text, number x, number y, number bgcolor, number fgcolor, any ...<br> **parameters:** number index, string text, number x, number y, number bgcolor, number fgcolor, any ...<br>
**returns:** self<br> **returns:** self<br>
## setScrollable ## setScrollable
Makes the radio scrollable Makes the radio scrollable
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aRadio = mainFrame:addRadio("myFirstRadio"):show() local aRadio = mainFrame:addRadio("myFirstRadio"):show()
aRadio:addItem("1. Entry",3,4) aRadio:addItem("1. Entry",3,4)
aRadio:addItem("2. Entry",3,5,colors.yellow) aRadio:addItem("2. Entry",3,5,colors.yellow)
aRadio:addItem("3. Entry",3,6,colors.yellow,colors.green) aRadio:addItem("3. Entry",3,6,colors.yellow,colors.green)
aRadio:setScrollable(true) aRadio:setScrollable(true)
```` ```
**parameters:** boolean isScrollable<br> **parameters:** boolean isScrollable<br>
**returns:** self<br> **returns:** self<br>
## selectItem ## selectItem
selects a item in the radio (same as a player would click on a item) selects a item in the radio (same as a player would click on a item)
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aRadio = mainFrame:addRadio("myFirstRadio"):show() local aRadio = mainFrame:addRadio("myFirstRadio"):show()
aRadio:addItem("1. Entry",3,4) aRadio:addItem("1. Entry",3,4)
aRadio:addItem("2. Entry",3,5,colors.yellow) aRadio:addItem("2. Entry",3,5,colors.yellow)
aRadio:addItem("3. Entry",3,6,colors.yellow,colors.green) aRadio:addItem("3. Entry",3,6,colors.yellow,colors.green)
aRadio:selectItem(1) aRadio:selectItem(1)
```` ```
**parameters:** number index<br> **parameters:** number index<br>
**returns:** self<br> **returns:** self<br>
## clear ## clear
clears the entire list (radio) clears the entire list (radio)
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aRadio = mainFrame:addRadio("myFirstRadio"):show() local aRadio = mainFrame:addRadio("myFirstRadio"):show()
aRadio:addItem("1. Entry",3,4) aRadio:addItem("1. Entry",3,4)
aRadio:addItem("2. Entry",3,5,colors.yellow) aRadio:addItem("2. Entry",3,5,colors.yellow)
aRadio:addItem("3. Entry",3,6,colors.yellow,colors.green) aRadio:addItem("3. Entry",3,6,colors.yellow,colors.green)
aRadio:clear() aRadio:clear()
```` ```
**parameters:** -<br> **parameters:** -<br>
**returns:** self<br> **returns:** self<br>
## getItemIndex ## getItemIndex
returns the item index of the currently selected item returns the item index of the currently selected item
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aRadio = mainFrame:addRadio("myFirstRadio"):show() local aRadio = mainFrame:addRadio("myFirstRadio"):show()
aRadio:addItem("1. Entry",3,4) aRadio:addItem("1. Entry",3,4)
aRadio:addItem("2. Entry",3,5,colors.yellow) aRadio:addItem("2. Entry",3,5,colors.yellow)
aRadio:addItem("3. Entry",3,6,colors.yellow,colors.green) aRadio:addItem("3. Entry",3,6,colors.yellow,colors.green)
aRadio:getItemIndex() aRadio:getItemIndex()
```` ```
**parameters:** -<br> **parameters:** -<br>
**returns:** number index<br> **returns:** number index<br>
## setSelectedItem ## setSelectedItem
Sets the background of the item which is currently selected Sets the background of the item which is currently selected
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aRadio = mainFrame:addRadio("myFirstRadio"):show() local aRadio = mainFrame:addRadio("myFirstRadio"):show()
aRadio:addItem("1. Entry",3,4) aRadio:addItem("1. Entry",3,4)
aRadio:addItem("2. Entry",3,5,colors.yellow) aRadio:addItem("2. Entry",3,5,colors.yellow)
aRadio:addItem("3. Entry",3,6,colors.yellow,colors.green) aRadio:addItem("3. Entry",3,6,colors.yellow,colors.green)
aRadio:setSelectedItem(colors.green, colors.blue) aRadio:setSelectedItem(colors.green, colors.blue)
```` ```
**parameters:** number bgcolor, number fgcolor, boolean isActive (isActive means if different colors for selected item should be used)<br> **parameters:** number bgcolor, number fgcolor, boolean isActive (isActive means if different colors for selected item should be used)<br>
**returns:** self<br> **returns:** self<br>

View File

@@ -1,48 +1,48 @@
Scrollbars are objects, the user can scroll vertically or horizontally, this can change the value.<br> Scrollbars are objects, the user can scroll vertically or horizontally, this can change the value.<br>
Here is a example of how to create a standard scrollbar: Here is a example of how to create a standard scrollbar:
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aScrollbar = mainFrame:addScrollbar("myFirstScrollbar"):show() local aScrollbar = mainFrame:addScrollbar("myFirstScrollbar"):show()
```` ```
Here are all possible functions available for scrollbars. Remember Scrollbar inherits from [Object](objects/Object.md) Here are all possible functions available for scrollbars. Remember Scrollbar inherits from [Object](objects/Object.md)
## setSymbol ## setSymbol
Changes the symbol Changes the symbol
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aScrollbar = mainFrame:addScrollbar("myFirstScrollbar"):setSymbol("X"):show() local aScrollbar = mainFrame:addScrollbar("myFirstScrollbar"):setSymbol("X"):show()
```` ```
**parameters:** char symbol<br> **parameters:** char symbol<br>
**returns:** self<br> **returns:** self<br>
## setBackgroundSymbol ## setBackgroundSymbol
Changes the background symbol color Changes the background symbol color
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aScrollbar = mainFrame:addScrollbar("myFirstScrollbar"):setSymbol("X"):setBackgroundSymbol(colors.green):show() local aScrollbar = mainFrame:addScrollbar("myFirstScrollbar"):setSymbol("X"):setBackgroundSymbol(colors.green):show()
```` ```
**parameters:** number symbolcolor<br> **parameters:** number symbolcolor<br>
**returns:** self<br> **returns:** self<br>
## setBarType ## setBarType
If the bar goes vertically or horizontally If the bar goes vertically or horizontally
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aScrollbar = mainFrame:addScrollbar("myFirstScrollbar"):setBarType("horizontal"):show() local aScrollbar = mainFrame:addScrollbar("myFirstScrollbar"):setBarType("horizontal"):show()
```` ```
**parameters:** string value ("vertical" or "horizontal")<br> **parameters:** string value ("vertical" or "horizontal")<br>
**returns:** self<br> **returns:** self<br>
## setMaxValue ## setMaxValue
the default max value is always the width (if horizontal) or height (if vertical), if you change the max value the bar will always calculate the value based on its width or height - example: you set the max value to 100, the height is 10 and it is a vertical bar, this means if the bar is on top, the value is 10, if the bar goes one below, it is 20 and so on. the default max value is always the width (if horizontal) or height (if vertical), if you change the max value the bar will always calculate the value based on its width or height - example: you set the max value to 100, the height is 10 and it is a vertical bar, this means if the bar is on top, the value is 10, if the bar goes one below, it is 20 and so on.
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aScrollbar = mainFrame:addScrollbar("myFirstScrollbar"):setMaxValue(123):show() local aScrollbar = mainFrame:addScrollbar("myFirstScrollbar"):setMaxValue(123):show()
```` ```
**parameters:** any number<br> **parameters:** any number<br>
**returns:** self<br> **returns:** self<br>

View File

@@ -5,37 +5,37 @@ Remember slider also inherits from [object](https://github.com/NoryiE/Basalt/wik
## setSymbol ## setSymbol
this will change the foreground symbol this will change the foreground symbol
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aSlider = mainFrame:addSlider("myFirstSlider"):setSymbol("X"):show() local aSlider = mainFrame:addSlider("myFirstSlider"):setSymbol("X"):show()
```` ```
**parameters:** char symbol<br> **parameters:** char symbol<br>
**returns:** self<br> **returns:** self<br>
## setBackgroundSymbol ## setBackgroundSymbol
this will change the symbol background color this will change the symbol background color
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aSlider = mainFrame:addSlider("myFirstSlider"):setBackgroundSymbol(colors.yellow):show() local aSlider = mainFrame:addSlider("myFirstSlider"):setBackgroundSymbol(colors.yellow):show()
```` ```
**parameters:** number color<br> **parameters:** number color<br>
**returns:** self<br> **returns:** self<br>
## setSymbolColor ## setSymbolColor
this will change the symbol color this will change the symbol color
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aSlider = mainFrame:addSlider("myFirstSlider"):setSymbolColor(colors.red):show() local aSlider = mainFrame:addSlider("myFirstSlider"):setSymbolColor(colors.red):show()
```` ```
**parameters:** number color<br> **parameters:** number color<br>
**returns:** self<br> **returns:** self<br>
## setBarType ## setBarType
this will change the bar to vertical/horizontal (default is horizontal) this will change the bar to vertical/horizontal (default is horizontal)
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aSlider = mainFrame:addSlider("myFirstSlider"):setBarType("vertical"):show() local aSlider = mainFrame:addSlider("myFirstSlider"):setBarType("vertical"):show()
```` ```
**parameters:** string value ("vertical", "horizontal"<br> **parameters:** string value ("vertical", "horizontal"<br>
**returns:** self<br> **returns:** self<br>

View File

@@ -1,10 +1,10 @@
Textfields are objects, where the user can write something on multiple lines. it act's like the default edit script (without coloring)<br> Textfields are objects, where the user can write something on multiple lines. it act's like the default edit script (without coloring)<br>
Here is a example of how to create a default textfield: Here is a example of how to create a default textfield:
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aTextfield = mainFrame:addTextfield("myFirstTextfield"):show() local aTextfield = mainFrame:addTextfield("myFirstTextfield"):show()
```` ```
This will create a default textfield with the size 10 width and 4 height on position 1 1 (relative to its parent frame), the default background is colors.gray, the default text color is colors.black and the default zIndex is 5. This will create a default textfield with the size 10 width and 4 height on position 1 1 (relative to its parent frame), the default background is colors.gray, the default text color is colors.black and the default zIndex is 5.
@@ -13,60 +13,60 @@ A list of all possible functions available for textfields. Remember Textfield in
## getLines ## getLines
returns all lines returns all lines
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aTextfield = mainFrame:addTextfield("myFirstTextfield"):show() local aTextfield = mainFrame:addTextfield("myFirstTextfield"):show()
basalt.debug(aTextfield:getLines()) basalt.debug(aTextfield:getLines())
```` ```
**parameters:** -<br> **parameters:** -<br>
**returns:** table lines<br> **returns:** table lines<br>
## getLine ## getLine
returns the line on index position returns the line on index position
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aTextfield = mainFrame:addTextfield("myFirstTextfield"):show() local aTextfield = mainFrame:addTextfield("myFirstTextfield"):show()
basalt.debug(aTextfield:getLine(2)) basalt.debug(aTextfield:getLine(2))
```` ```
**parameters:** number index<br> **parameters:** number index<br>
**returns:** string line<br> **returns:** string line<br>
## editLine ## editLine
edits line on index position edits line on index position
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aTextfield = mainFrame:addTextfield("myFirstTextfield"):show() local aTextfield = mainFrame:addTextfield("myFirstTextfield"):show()
aTextfield:editLine(2, "hellow") aTextfield:editLine(2, "hellow")
```` ```
**parameters:** number index, string text<br> **parameters:** number index, string text<br>
**returns:** self<br> **returns:** self<br>
## addLine ## addLine
adds a line on index position (if index is nil it just adds the line on the bottom) adds a line on index position (if index is nil it just adds the line on the bottom)
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aTextfield = mainFrame:addTextfield("myFirstTextfield"):show() local aTextfield = mainFrame:addTextfield("myFirstTextfield"):show()
aTextfield:addLine("hellow") aTextfield:addLine("hellow")
```` ```
**parameters:** string text, number index<br> **parameters:** string text, number index<br>
**returns:** self<br> **returns:** self<br>
## removeLine ## removeLine
removes the line on index position removes the line on index position
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aTextfield = mainFrame:addTextfield("myFirstTextfield"):show() local aTextfield = mainFrame:addTextfield("myFirstTextfield"):show()
aTextfield:removeLine(1) aTextfield:removeLine(1)
```` ```
**parameters:** number index<br> **parameters:** number index<br>
**returns:** self<br> **returns:** self<br>
## getTextCursor ## getTextCursor
returns the cursor position returns the cursor position
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aTextfield = mainFrame:addTextfield("myFirstTextfield"):show() local aTextfield = mainFrame:addTextfield("myFirstTextfield"):show()
basalt.debug(aTextfield:getTextCursor()) basalt.debug(aTextfield:getTextCursor())
```` ```
**parameters:** -<br> **parameters:** -<br>
**returns:** number x, number y<br> **returns:** number x, number y<br>

View File

@@ -4,7 +4,7 @@ Here is a list of all available functions for threads: <br>
## start ## start
starts a new thread and executes the function starts a new thread and executes the function
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aThread = mainFrame:addThread("myFirstThread"):show() local aThread = mainFrame:addThread("myFirstThread"):show()
local function randomThreadFunction() local function randomThreadFunction()
@@ -14,23 +14,23 @@ local function randomThreadFunction()
end end
end end
aThread:start(randomThreadfunction) aThread:start(randomThreadfunction)
```` ```
**parameters:**function func<br> **parameters:**function func<br>
**returns:** self<br> **returns:** self<br>
## getStatus ## getStatus
gets the thread status gets the thread status
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aThread = mainFrame:addThread("myFirstThread"):show() local aThread = mainFrame:addThread("myFirstThread"):show()
basalt.debug(aThread:getStatus()) -- returns "running", "normal", "suspended" or "dead" basalt.debug(aThread:getStatus()) -- returns "running", "normal", "suspended" or "dead"
```` ```
**parameters:** -<br> **parameters:** -<br>
**returns:** string "running" - if its running, "normal" - is active but not running (waiting for a event), "suspended" - is suspended<br> **returns:** string "running" - if its running, "normal" - is active but not running (waiting for a event), "suspended" - is suspended<br>
## stop ## stop
stops the thread stops the thread
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aThread = mainFrame:addThread("myFirstThread"):show() local aThread = mainFrame:addThread("myFirstThread"):show()
local function randomThreadFunction() local function randomThreadFunction()
@@ -42,6 +42,6 @@ end
aThread:start(randomThreadfunction) aThread:start(randomThreadfunction)
local aButton = mainFrame:addButton("myFirstButton"):setText("Stop Thread"):onClick(function() aThread:stop() end):show() local aButton = mainFrame:addButton("myFirstButton"):setText("Stop Thread"):onClick(function() aThread:stop() end):show()
```` ```
**parameters:** -<br> **parameters:** -<br>
**returns:** self<br> **returns:** self<br>

View File

@@ -4,39 +4,39 @@ Here is a list of all available functions for timers: <br>
## setTime ## setTime
sets the time the timer should wait after calling your function sets the time the timer should wait after calling your function
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aTimer = mainFrame:addTimer("myFirstTimer") local aTimer = mainFrame:addTimer("myFirstTimer")
aTimer:setTime(5) aTimer:setTime(5)
```` ```
**parameters:**number time[, number repeats] - (time in seconds, if repeats is -1 it will call the function infinitly (every x seconds)<br> **parameters:**number time[, number repeats] - (time in seconds, if repeats is -1 it will call the function infinitly (every x seconds)<br>
**returns:** self<br> **returns:** self<br>
## start ## start
starts the timer starts the timer
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aTimer = mainFrame:addTimer("myFirstTimer") local aTimer = mainFrame:addTimer("myFirstTimer")
aTimer:setTime(5):start() aTimer:setTime(5):start()
```` ```
**parameters:** -<br> **parameters:** -<br>
**returns:** self<br> **returns:** self<br>
## cancel ## cancel
stops/cancels the timer stops/cancels the timer
````lua ```lua
local mainFrame = basalt.createFrame("myFirstFrame"):show() local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aTimer = mainFrame:addTimer("myFirstTimer") local aTimer = mainFrame:addTimer("myFirstTimer")
aTimer:setTime(5):start() aTimer:setTime(5):start()
aTimer:cancel() aTimer:cancel()
```` ```
**parameters:** -<br> **parameters:** -<br>
**returns:** self<br> **returns:** self<br>
## onCall ## onCall
adds a function to the timer adds a function to the timer
````lua ```lua
local function timerCall(self) local function timerCall(self)
basalt.debug("i got called!") basalt.debug("i got called!")
end end
@@ -44,6 +44,6 @@ local mainFrame = basalt.createFrame("myFirstFrame"):show()
local aTimer = mainFrame:addTimer("myFirstTimer") local aTimer = mainFrame:addTimer("myFirstTimer")
aTimer:setTime(5):onCall(timerCall):start() aTimer:setTime(5):onCall(timerCall):start()
```` ```
**parameters:** function func<br> **parameters:** function func<br>
**returns:** self<br> **returns:** self<br>

View File

@@ -4,7 +4,7 @@ To make this possible the button needs 1 onClick event, 1 onClickUp event and 1
Very interesting sidetip: events can hold multiple functions!<br> Very interesting sidetip: events can hold multiple functions!<br>
**Example snippet:** **Example snippet:**
````lua ```lua
local function buttonColoring() local function buttonColoring()
-- here you can add some coloring for your button -- here you can add some coloring for your button
end end
@@ -13,14 +13,14 @@ local function buttonLogic()
end end
local button = mainFrame:addButton("ExampleButton"):show() local button = mainFrame:addButton("ExampleButton"):show()
button:onClick(buttonColoring):onClick(buttonLogic) -- yes this would work, if not its a bug! button:onClick(buttonColoring):onClick(buttonLogic) -- yes this would work, if not its a bug!
```` ```
This means you can create a function wich handles only the coloring side of your button, and if your button also needs some logic you just create your own unique function for that and add it to your button. This means you can create a function wich handles only the coloring side of your button, and if your button also needs some logic you just create your own unique function for that and add it to your button.
With this knowledge we create now a function where we pass a button-object as parameter and this will setup the coloring of our button: With this knowledge we create now a function where we pass a button-object as parameter and this will setup the coloring of our button:
**Example snippet:** **Example snippet:**
````lua ```lua
local basalt = dofile("basalt.lua") local basalt = dofile("basalt.lua")
local mainFrame = basalt.createFrame("mainFrame"):show() local mainFrame = basalt.createFrame("mainFrame"):show()
local button = mainFrame:addButton("firstButton"):setPosition(3,3):setSize(12,3):setText("Click me"):setBackground(colors.gray):setForeground(colors.black):show() local button = mainFrame:addButton("firstButton"):setPosition(3,3):setSize(12,3):setText("Click me"):setBackground(colors.gray):setForeground(colors.black):show()
@@ -36,6 +36,6 @@ setupButtonColoring(button)
setupButtonColoring(button2) setupButtonColoring(button2)
basalt.autoUpdate() basalt.autoUpdate()
```` ```
Now you've got a function which sets your buttons up. Now you've got a function which sets your buttons up.

View File

@@ -3,7 +3,7 @@ You question yourself how you can execute your own logic while basalt is also ac
## Method 1: ## Method 1:
Using parallel.waitForAll Using parallel.waitForAll
````lua ```lua
local basalt = dofile("basalt.lua") local basalt = dofile("basalt.lua")
local mainFrame = basalt.createFrame("mainFrame"):show()-- lets create a frame and a button without functionality local mainFrame = basalt.createFrame("mainFrame"):show()-- lets create a frame and a button without functionality
@@ -17,13 +17,13 @@ local function yourCustomHandler()
end end
parallel.waitForAll(basalt.autoUpdate, yourCustomHandler) -- here it will handle your function (yourCustomHandler) and basalts handlers at the time parallel.waitForAll(basalt.autoUpdate, yourCustomHandler) -- here it will handle your function (yourCustomHandler) and basalts handlers at the time
```` ```
You can read [here](http://www.computercraft.info/wiki/Parallel_(API)) what exactly parallel.waitForAll() does You can read [here](http://www.computercraft.info/wiki/Parallel_(API)) what exactly parallel.waitForAll() does
## Method 2: ## Method 2:
Using threads Using threads
````lua ```lua
local basalt = dofile("basalt.lua") local basalt = dofile("basalt.lua")
local mainFrame = basalt.createFrame("mainFrame"):show()-- lets create a frame, a button without functionality and a thread local mainFrame = basalt.createFrame("mainFrame"):show()-- lets create a frame, a button without functionality and a thread
@@ -37,12 +37,12 @@ local function yourCustomHandler()
end end
end end
thread:start(yourCustomHandler) -- this will create a coroutine and starts the coroutine, os.sleep does the rest, so you just have to call start once. thread:start(yourCustomHandler) -- this will create a coroutine and starts the coroutine, os.sleep does the rest, so you just have to call start once.
```` ```
## Method 3: ## Method 3:
Using timers Using timers
````lua ```lua
local basalt = dofile("basalt.lua") local basalt = dofile("basalt.lua")
local mainFrame = basalt.createFrame("mainFrame"):show()-- lets create a frame, a button without functionality and a timer local mainFrame = basalt.createFrame("mainFrame"):show()-- lets create a frame, a button without functionality and a timer
@@ -53,4 +53,4 @@ local function yourCustomHandler()
-- add your logic here -- add your logic here
end end
timer:onCall(yourCustomHandler):setTime(1, -1):start() -- this will call your function every second until you :cancel() the timer timer:onCall(yourCustomHandler):setTime(1, -1):start() -- this will call your function every second until you :cancel() the timer
```` ```