docs again
This commit is contained in:
@@ -15,7 +15,7 @@ Create a base-frame (main frame)
|
||||
#### Usage:
|
||||
* Create and show a frame with id "myFirstFrame"
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local mainFrame = basalt.createFrame("myFirstFrame")
|
||||
```
|
||||
|
||||
## basalt.removeFrame
|
||||
@@ -27,7 +27,7 @@ Removes a base frame
|
||||
#### Usage:
|
||||
* Removes the previously created frame with id "myFirstFrame"
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local mainFrame = basalt.createFrame("myFirstFrame")
|
||||
basalt.removeFrame("myFirstFrame")
|
||||
```
|
||||
|
||||
@@ -42,7 +42,7 @@ Returns a base frame with the given name
|
||||
#### Usage:
|
||||
* Creates, fetches and shows the "myFirstFrame" object
|
||||
```lua
|
||||
basalt.createFrame("myFirstFrame")
|
||||
basalt.createFrame("myFirstFrame"):hide()
|
||||
basalt.getFrame("myFirstFrame"):show()
|
||||
```
|
||||
|
||||
@@ -56,8 +56,8 @@ Returns the currently active base frame
|
||||
#### Usage:
|
||||
* Displays the active frame name in the debug console
|
||||
```lua
|
||||
basalt.createFrame("myFirstFrame"):show()
|
||||
basalt.debug(basalt.getActiveFrame():getName()) -- returns myFirstFrame
|
||||
basalt.createFrame()
|
||||
basalt.debug(basalt.getActiveFrame():getName()) -- returns the uuid
|
||||
```
|
||||
|
||||
## basalt.autoUpdate
|
||||
@@ -66,7 +66,7 @@ Starts the draw and event handler until basalt.stopUpdate() is called
|
||||
#### Usage:
|
||||
* Enable the basalt updates, otherwise the screen will not continue to update
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local mainFrame = basalt.createFrame()
|
||||
basalt.autoUpdate()
|
||||
```
|
||||
|
||||
@@ -81,8 +81,8 @@ Calls the draw and event handler once - this gives more flexibility about which
|
||||
#### Usage:
|
||||
* Creates and starts a custom update cycle
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local aButton = mainFrame:addButton("myButton"):setPosition(2,2):show()
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aButton = mainFrame:addButton():setPosition(2,2)
|
||||
|
||||
while true do
|
||||
basalt.update(os.pullEventRaw())
|
||||
@@ -95,8 +95,8 @@ Stops the automatic draw and event handler which got started by basalt.autoUpdat
|
||||
#### Usage:
|
||||
* When the quit button is clicked, the button stops basalt auto updates
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local aButton = mainFrame:addButton("myButton"):setPosition(2,2):setText("Stop Basalt!"):show()
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aButton = mainFrame:addButton():setPosition(2,2):setText("Stop Basalt!")
|
||||
|
||||
aButton:onClick(function()
|
||||
basalt.stopUpdate()
|
||||
@@ -117,8 +117,8 @@ Checks if the user is currently holding a key
|
||||
#### Usage:
|
||||
* Shows a debug message with true or false if the left ctrl key is down, as soon as you click on the button.
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local aButton = mainFrame:addButton("myButton"):setPosition(2,2):setText("Check Ctrl"):show()
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aButton = mainFrame:addButton():setPosition(2,2):setText("Check Ctrl")
|
||||
|
||||
aButton:onClick(function()
|
||||
basalt.debug(basalt.isKeyDown(keys.leftCtrl) )
|
||||
@@ -136,10 +136,75 @@ which returns the debug Label.
|
||||
Also basalt.debugFrame and basalt.debugList are available.
|
||||
|
||||
#### Parameters:
|
||||
1. `...` (multiple parameters are possible, like print does)<br>
|
||||
1. `...` (multiple parameters are possible, like print does)
|
||||
|
||||
#### Usage:
|
||||
* Prints "Hello! ^-^" to the debug console
|
||||
```lua
|
||||
basalt.debug("Hello! ", "^-^")
|
||||
```
|
||||
|
||||
## setTheme
|
||||
Sets the base theme of the project! Make sure to cover all existing objects, otherwise it will result in errors. A good example is [theme](https://github.com/Pyroxenium/Basalt/blob/master/Basalt/theme.lua)
|
||||
|
||||
#### Parameters:
|
||||
1. `table` theme layout look into [theme](https://github.com/Pyroxenium/Basalt/blob/master/Basalt/theme.lua) for a example
|
||||
|
||||
#### Usage:
|
||||
* Creates a new base frame and adds a new theme which only changes the default color of buttons.
|
||||
```lua
|
||||
basalt.setTheme({
|
||||
ButtonBG = colors.yellow,
|
||||
ButtonText = colors.red,
|
||||
...,
|
||||
})
|
||||
```
|
||||
|
||||
## setVariable
|
||||
This stores a variable which you're able to access via xml. You are also able to add a function, which then gets called by object events created in XML.
|
||||
|
||||
#### Parameters:
|
||||
1. `string` a key name
|
||||
1. `any` any variable
|
||||
|
||||
#### Usage:
|
||||
* Adds a function to basalt.
|
||||
```lua
|
||||
basalt.setVariable("clickMe", function()
|
||||
basalt.debug("I got clicked")
|
||||
end)
|
||||
```
|
||||
```xml
|
||||
<button onClick="clickMe" text="Click me" />
|
||||
```
|
||||
|
||||
## shedule
|
||||
Shedules a function which gets called in a coroutine. After the coroutine is finished it will get destroyed immediatly. It's something like threads, but with some limits.
|
||||
|
||||
#### Parameters:
|
||||
1. `function` a function which should get executed
|
||||
|
||||
#### Returns:
|
||||
1. `coroutine` it returns the coroutine which got created to execute the function
|
||||
|
||||
#### Usage:
|
||||
* Creates a shedule which switches the color between red and gray
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aButton = mainFrame:addButton():setText("Click me")
|
||||
aButton:onClick(function()
|
||||
basalt.shedule(function()
|
||||
aButton:setBackground(colors.red)
|
||||
os.sleep(0.1)
|
||||
aButton:setBackground(colors.gray)
|
||||
os.sleep(0.1)
|
||||
aButton:setBackground(colors.red)
|
||||
os.sleep(0.1)
|
||||
aButton:setBackground(colors.gray)
|
||||
os.sleep(0.1)
|
||||
aButton:setBackground(colors.red)
|
||||
os.sleep(0.1)
|
||||
aButton:setBackground(colors.gray)
|
||||
end)
|
||||
end)
|
||||
```
|
||||
@@ -16,7 +16,6 @@ Sets the displayed button text
|
||||
local mainFrame = basalt.createFrame()
|
||||
local button = mainFrame:addButton():setText("Click me!")
|
||||
```
|
||||
|
||||
```xml
|
||||
<button text="Click me!" />
|
||||
```
|
||||
@@ -38,7 +37,6 @@ local button = mainFrame:addButton()
|
||||
:setText("Click me!")
|
||||
:setHorizontalAlign("right")
|
||||
```
|
||||
|
||||
```xml
|
||||
<button text="Click me!" horizontalAlign="right" />
|
||||
```
|
||||
@@ -88,7 +86,6 @@ basalt.setVariable("buttonClick", function(self,event,button,x,y)
|
||||
end
|
||||
end)
|
||||
```
|
||||
|
||||
```xml
|
||||
<button onClick="buttonClick" text="Click" />
|
||||
```
|
||||
@@ -18,7 +18,6 @@ Changes the input type. default: text
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aInput = mainFrame:addInput():setInputType("number")
|
||||
```
|
||||
|
||||
```xml
|
||||
<input type="number" />
|
||||
```
|
||||
|
||||
@@ -1,151 +1,279 @@
|
||||
Lists are objects where you can create endless entrys and the user can choose one of them
|
||||
Lists are objects where you can create endless entries, and the user is able to select one of them
|
||||
|
||||
Here is a example of how to create a standard list:
|
||||
If you want to access values inside items this is how the table for single items is made (just a example):
|
||||
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local aList = mainFrame:addList("myFirstList"):show()
|
||||
item = {
|
||||
text="1. Entry",
|
||||
bgCol=colors.black,
|
||||
fgCol=colors.white
|
||||
args = {}
|
||||
}
|
||||
```
|
||||
|
||||
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 ">"
|
||||
|
||||
Here are all possible functions available for lists. Remember List inherits from [Object](objects/Object.md)
|
||||
Remember Lists also inherits from [Object](objects/Object.md)
|
||||
|
||||
## addItem
|
||||
Adds a item into the list
|
||||
|
||||
#### Parameters:
|
||||
1. `string` The entry name
|
||||
2. `number|color` unique default background color - optional
|
||||
3. `number|color` unique default text color - optional
|
||||
4. `any` any value - you could access this later in a :onChange() event (you need to use :getValue()) - optional
|
||||
|
||||
#### Returns:
|
||||
1. `object` The object in use
|
||||
|
||||
#### Usage:
|
||||
* Creates a default list with 3 entries
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local aList = mainFrame:addList("myFirstList"):show()
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aList = mainFrame:addList()
|
||||
aList:addItem("1. Entry")
|
||||
aList:addItem("2. Entry",colors.yellow)
|
||||
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>
|
||||
#### Returns: self<br>
|
||||
```xml
|
||||
<list>
|
||||
<item><text>1. Entry</text></item>
|
||||
<item><text>2. Entry</text><bg>yellow</bg></item>
|
||||
<item><text>3. Entry</text><bg>yellow</bg><fg>green</fg></item>
|
||||
</list>
|
||||
```
|
||||
|
||||
## removeItem
|
||||
Removes a item from the list
|
||||
|
||||
#### Parameters:
|
||||
1. `number` The index which should get removed
|
||||
|
||||
#### Returns:
|
||||
1. `object` The object in use
|
||||
|
||||
#### Usage:
|
||||
* Creates a default list with 3 entries and removes the second one.
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local aList = mainFrame:addList("myFirstList"):show()
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aList = mainFrame:addList()
|
||||
aList:addItem("1. Entry")
|
||||
aList:addItem("2. Entry",colors.yellow)
|
||||
aList:addItem("3. Entry",colors.yellow,colors.green)
|
||||
aList:removeItem(2)
|
||||
```
|
||||
#### Parameters: number index<br>
|
||||
#### Returns: self<br>
|
||||
|
||||
## editItem
|
||||
Edits a item on the list
|
||||
Edits a item from the list
|
||||
|
||||
#### Parameters:
|
||||
1. `number` The index which should be edited
|
||||
2. `string` The new item name
|
||||
3. `number` the new item background color - optional
|
||||
4. `number` The new item text color - optional
|
||||
5. `any` New additional information - optional
|
||||
|
||||
#### Returns:
|
||||
1. `object` The object in use
|
||||
|
||||
#### Usage:
|
||||
* Creates a default list with 3 entries and changes the second one.
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local aList = mainFrame:addList("myFirstList"):show()
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aList = mainFrame:addList()
|
||||
aList:addItem("1. Entry")
|
||||
aList:addItem("2. Entry",colors.yellow)
|
||||
aList:addItem("3. Entry",colors.yellow,colors.green)
|
||||
aList:editItem(3,"3. Edited Entry",colors.yellow,colors.green)
|
||||
aList:editItem(2, "Still 2. Entry", colors.red)
|
||||
```
|
||||
#### Parameters: number index, string text, number bgcolor, number fgcolor, any ...<br>
|
||||
#### Returns: self<br>
|
||||
|
||||
## setScrollable
|
||||
Makes the list scrollable
|
||||
## getItem
|
||||
Returns a item by index
|
||||
|
||||
#### Parameters:
|
||||
1. `number` The index which should be returned
|
||||
|
||||
#### Returns:
|
||||
1. `table` The item table example: {text="1. Entry", bgCol=colors.black, fgCol=colors.white}
|
||||
|
||||
#### Usage:
|
||||
* Creates a default list with 3 entries and edits the second one.
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local aList = mainFrame:addList("myFirstList"):show()
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aList = mainFrame:addList()
|
||||
aList:addItem("1. Entry")
|
||||
aList:addItem("2. Entry",colors.yellow)
|
||||
aList:addItem("3. Entry",colors.yellow,colors.green)
|
||||
aList:setScrollable(true)
|
||||
basalt.debug(aList:getItem(2).text)
|
||||
```
|
||||
|
||||
## getItemCount
|
||||
Returns the current item count
|
||||
|
||||
#### Returns:
|
||||
1. `number` The item list count
|
||||
|
||||
#### Usage:
|
||||
* Creates a default list with 3 entries and prints the current item count.
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aList = mainFrame:addList()
|
||||
aList:addItem("1. Entry")
|
||||
aList:addItem("2. Entry",colors.yellow)
|
||||
aList:addItem("3. Entry",colors.yellow,colors.green)
|
||||
basalt.debug(aList:getItemCount())
|
||||
```
|
||||
|
||||
## getAll
|
||||
Returns all items as table
|
||||
|
||||
#### Returns:
|
||||
1. `table` All items
|
||||
|
||||
#### Usage:
|
||||
* Creates a default menubar with 3 entries and prints a table.
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aList = mainFrame:addList()
|
||||
aList:addItem("1. Entry")
|
||||
aList:addItem("2. Entry",colors.yellow)
|
||||
aList:addItem("3. Entry",colors.yellow,colors.green)
|
||||
basalt.debug(aList:getAll())
|
||||
```
|
||||
#### Parameters: boolean isScrollable<br>
|
||||
#### Returns: self<br>
|
||||
|
||||
## selectItem
|
||||
selects a item in the list (same as a player would click on a item)
|
||||
|
||||
#### Parameters:
|
||||
1. `number` The index which should get selected
|
||||
|
||||
#### Returns:
|
||||
1. `object` The object in use
|
||||
|
||||
#### Usage:
|
||||
* Creates a default list with 3 entries and selects the second entry.
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local aList = mainFrame:addList("myFirstList"):show()
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aList = mainFrame:addList()
|
||||
aList:addItem("1. Entry")
|
||||
aList:addItem("2. Entry",colors.yellow)
|
||||
aList:addItem("3. Entry",colors.yellow,colors.green)
|
||||
aList:selectItem(1)
|
||||
aList:selectItem(2)
|
||||
```
|
||||
#### Parameters: number index<br>
|
||||
#### Returns: self<br>
|
||||
|
||||
## clear
|
||||
clears the entire list
|
||||
Removes all items.
|
||||
|
||||
#### Returns:
|
||||
1. `object` The object in use
|
||||
|
||||
#### Usage:
|
||||
* Creates a default list with 3 entries and removes them immediatley. Which makes no sense.
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show()
|
||||
aDropdown:addItem("1. Entry")
|
||||
aDropdown:addItem("2. Entry",colors.yellow)
|
||||
aDropdown:addItem("3. Entry",colors.yellow,colors.green)
|
||||
aDropdown:clear()
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aList = mainFrame:addList()
|
||||
aList:addItem("1. Entry")
|
||||
aList:addItem("2. Entry",colors.yellow)
|
||||
aList:addItem("3. Entry",colors.yellow,colors.green)
|
||||
aList:clear()
|
||||
```
|
||||
#### Parameters: -<br>
|
||||
#### Returns: self<br>
|
||||
|
||||
## getItemIndex
|
||||
returns the item index of the currently selected item
|
||||
|
||||
#### Returns:
|
||||
1. `number` The current index
|
||||
|
||||
#### Usage:
|
||||
* Creates a default list with 3 entries selects the second entry and prints the currently selected index.
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local aDropdown = mainFrame:addDropdown("myFirstDropdown"):show()
|
||||
aDropdown:addItem("1. Entry")
|
||||
aDropdown:addItem("2. Entry",colors.yellow)
|
||||
aDropdown:addItem("3. Entry",colors.yellow,colors.green)
|
||||
aDropdown:getItemIndex()
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aList = mainFrame:addList()
|
||||
aList:addItem("1. Entry")
|
||||
aList:addItem("2. Entry",colors.yellow)
|
||||
aList:addItem("3. Entry",colors.yellow,colors.green)
|
||||
aList:selectItem(2)
|
||||
basalt.debug(aList:getItemIndex())
|
||||
```
|
||||
#### Parameters: -<br>
|
||||
#### Returns: number index<br>
|
||||
|
||||
## setSelectedItem
|
||||
Sets the background of the item which is currently selected
|
||||
Sets the background and the foreground of the item which is currently selected
|
||||
|
||||
#### Parameters:
|
||||
1. `number|color` The background color which should be used
|
||||
2. `number|color` The text color which should be used
|
||||
|
||||
#### Returns:
|
||||
1. `object` The object in use
|
||||
|
||||
#### Usage:
|
||||
* Creates a default list with 4 entries and sets the selection background color to green.
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local aList = mainFrame:addList("myFirstList"):show()
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aList = mainFrame:addList()
|
||||
aList:addItem("1. Entry")
|
||||
aList:addItem("2. Entry",colors.yellow)
|
||||
aList:addItem("3. Entry",colors.yellow,colors.green)
|
||||
aList:setSelectedItem(colors.green, colors.blue)
|
||||
aList:addItem("4. Entry")
|
||||
aList:setSelectedItem(colors.green, colors.red)
|
||||
```
|
||||
```xml
|
||||
<list selectionBG="green" selectionFG="red">
|
||||
<item><text>1. Entry</text></item>
|
||||
<item><text>2. Entry</text><bg>yellow</bg></item>
|
||||
<item><text>2. Entry</text><bg>yellow</bg><fg>green</fg></item>
|
||||
</list>
|
||||
```
|
||||
#### Parameters: number bgcolor, number fgcolor, boolean isActive (isActive means if different colors for selected item should be used)<br>
|
||||
#### Returns: self<br>
|
||||
|
||||
## setOffset
|
||||
sets the list offset (will automatically change if scrolling is active)
|
||||
Sets the offset of the list (the same as you would scroll) - default is 0
|
||||
|
||||
#### Parameters:
|
||||
1. `number` The offset value
|
||||
|
||||
#### Returns:
|
||||
1. `object` The object in use
|
||||
|
||||
#### Usage:
|
||||
* Creates a default list with 6 entries and sets the offset to 3.
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local aList = mainFrame:addList("myFirstList"):show()
|
||||
aList:addItem("1. Entry")
|
||||
aList:addItem("2. Entry",colors.yellow)
|
||||
aList:addItem("3. Entry",colors.yellow,colors.green)
|
||||
aList:setOffset(3)
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aList = mainFrame:addList()
|
||||
:addItem("1. Entry")
|
||||
:addItem("2. Entry")
|
||||
:addItem("3. Entry")
|
||||
:addItem("4. Entry")
|
||||
:addItem("5. Entry")
|
||||
:addItem("6. Entry")
|
||||
:setOffset(3)
|
||||
```
|
||||
```xml
|
||||
<list offset="3">
|
||||
<item><text>1. Entry</text></item>
|
||||
<item><text>2. Entry</text></item>
|
||||
<item><text>3. Entry</text></item>
|
||||
<item><text>4. Entry</text></item>
|
||||
<item><text>5. Entry</text></item>
|
||||
<item><text>6. Entry</text></item>
|
||||
</list>
|
||||
```
|
||||
#### Parameters: number offsetValue<br>
|
||||
#### Returns: self<br>
|
||||
|
||||
## getOffset
|
||||
returns the current offset
|
||||
Returns the current index offset
|
||||
|
||||
#### Returns:
|
||||
1. `number` offset value
|
||||
|
||||
#### Usage:
|
||||
* Creates a default list with 6 entries and sets the offset to 3, also prints the current offset.
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local aList = mainFrame:addList("myFirstList"):show()
|
||||
aList:addItem("1. Entry")
|
||||
aList:addItem("2. Entry",colors.yellow)
|
||||
aList:addItem("3. Entry",colors.yellow,colors.green)
|
||||
aList:getOffset()
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aList = mainFrame:addList()
|
||||
:addItem("1. Entry")
|
||||
:addItem("2. Entry")
|
||||
:addItem("3. Entry")
|
||||
:addItem("4. Entry")
|
||||
:addItem("5. Entry")
|
||||
:addItem("6. Entry")
|
||||
:setOffset(3)
|
||||
basalt.debug(aList:getOffset())
|
||||
```
|
||||
#### Parameters: -<br>
|
||||
#### Returns: number offsetValue<br>
|
||||
@@ -1,4 +1,4 @@
|
||||
This is the base class of all visual objects. This means, if you create a button, label, frame or something else visual (no timers, threads or animations) the following methods apply:
|
||||
This is the base class for all visual objects. Which means, if you create a button, label, frame or something else (no timers, threads or animations) the following methods apply:
|
||||
|
||||
## show
|
||||
Shows the object (only if the parent frame is already visible)
|
||||
@@ -8,12 +8,12 @@ Shows the object (only if the parent frame is already visible)
|
||||
#### Usage:
|
||||
* Shows a frame
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame():show()
|
||||
local mainFrame = basalt.createFrame()
|
||||
local button = mainFrame:addButton()
|
||||
button:show()
|
||||
```
|
||||
```xml
|
||||
<button visible="true"></button>
|
||||
<button visible="true" />
|
||||
```
|
||||
|
||||
## hide
|
||||
@@ -27,10 +27,9 @@ Hides the object
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
local button = mainFrame:addButton():setText("Close"):onClick(function() mainFrame:hide() end)
|
||||
button
|
||||
```
|
||||
```xml
|
||||
<button visible="false"></button>
|
||||
<button visible="false" />
|
||||
```
|
||||
|
||||
## setPosition
|
||||
@@ -50,7 +49,7 @@ local mainFrame = basalt.createFrame()
|
||||
mainFrame:addButton():setPosition(2,3)
|
||||
```
|
||||
```xml
|
||||
<button x="2" y="3"></button>
|
||||
<button x="2" y="3" />
|
||||
```
|
||||
|
||||
## setBackground
|
||||
@@ -67,7 +66,7 @@ Changes the object background color, if you set the value to false the backgroun
|
||||
local mainFrame = basalt.createFrame():setBackground(colors.gray)
|
||||
```
|
||||
```xml
|
||||
<button bg="gray"></button>
|
||||
<button bg="gray" />
|
||||
```
|
||||
|
||||
## setForeground
|
||||
@@ -84,7 +83,7 @@ Changes the object text color
|
||||
local mainFrame = basalt.createFrame():setForeground(colors.green)
|
||||
```
|
||||
```xml
|
||||
<button fg="green"></button>
|
||||
<button fg="green" />
|
||||
```
|
||||
|
||||
## setSize
|
||||
@@ -103,7 +102,7 @@ local mainFrame = basalt.createFrame()
|
||||
local subFrame = mainFrame:addFrame():setSize(15,12)
|
||||
```
|
||||
```xml
|
||||
<frame width="15" height="12"></frame>
|
||||
<frame width="15" height="12" />
|
||||
```
|
||||
|
||||
## setFocus
|
||||
@@ -136,8 +135,8 @@ local aButton = mainFrame:addButton():setZIndex(1):setPosition(2,2)
|
||||
local aLabel = mainFrame:addButton():setZIndex(2):setPosition(2,2):setText("I am a label!")
|
||||
```
|
||||
```xml
|
||||
<button x="2" y="2" zIndex="1"></button>
|
||||
<label x="2" y="2" text="I am a label!" zIndex="2"></label>
|
||||
<button x="2" y="2" zIndex="1" />
|
||||
<label x="2" y="2" text="I am a label!" zIndex="2" />
|
||||
```
|
||||
|
||||
## setParent
|
||||
@@ -214,10 +213,8 @@ local aButton = mainFrame:addButton()
|
||||
:setSize(8,1)
|
||||
:setPosition(-8,1)
|
||||
```
|
||||
|
||||
#### XML:
|
||||
```xml
|
||||
<button anchor="bottomRight"></button>
|
||||
<button anchor="bottomRight" />
|
||||
```
|
||||
|
||||
## getAbsolutePosition
|
||||
@@ -252,7 +249,7 @@ local mainFrame = basalt.createFrame()
|
||||
local aCheckbox = mainFrame:addCheckbox():setValue(true)
|
||||
```
|
||||
```xml
|
||||
<checkbox value="true"></checkbox>
|
||||
<checkbox value="true" />
|
||||
```
|
||||
|
||||
## getValue
|
||||
@@ -327,7 +324,7 @@ local subFrame = mainFrame:addFrame()
|
||||
:showShadow(true)
|
||||
```
|
||||
```xml
|
||||
<frame width="18" height="6" shadow="true" shadowColor="green" moveable="true"></frame>
|
||||
<frame width="18" height="6" shadow="true" shadowColor="green" moveable="true" />
|
||||
```
|
||||
|
||||
## showShadow
|
||||
@@ -349,7 +346,7 @@ local subFrame = mainFrame:addFrame()
|
||||
:showShadow(true)
|
||||
```
|
||||
```xml
|
||||
<frame width="18" height="6" shadow="true" moveable="true"></frame>
|
||||
<frame width="18" height="6" shadow="true" moveable="true" />
|
||||
```
|
||||
|
||||
## setBorder
|
||||
@@ -372,7 +369,7 @@ local subFrame = mainFrame:addFrame()
|
||||
:showBorder("left", "top", "right", "bottom")
|
||||
```
|
||||
```xml
|
||||
<frame width="18" height="6" border="true" borderColor="green" moveable="true"></frame>
|
||||
<frame width="18" height="6" border="true" borderColor="green" moveable="true" />
|
||||
```
|
||||
|
||||
## showBorder
|
||||
@@ -394,5 +391,5 @@ local subFrame = mainFrame:addFrame()
|
||||
:showBorder("left", "top", "bottom")
|
||||
```
|
||||
```xml
|
||||
<frame width="18" height="6" border="true" borderColor="green" borderRight="false" moveable="true"></frame>
|
||||
<frame width="18" height="6" border="true" borderColor="green" borderRight="false" moveable="true" />
|
||||
```
|
||||
@@ -13,8 +13,8 @@ returns the current process status
|
||||
#### Usage:
|
||||
* Prints current status
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local aProgram = mainFrame:addProgram("myFirstProgram"):show()
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aProgram = mainFrame:addProgram()
|
||||
basalt.debug(aProgram:getStatus())
|
||||
```
|
||||
|
||||
@@ -30,8 +30,8 @@ Executes the given path or program
|
||||
#### Usage:
|
||||
* Executes worm
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local aProgram = mainFrame:addProgram("myFirstProgram"):show()
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aProgram = mainFrame:addProgram()
|
||||
aProgram:execute("rom/programs/fun/worm.lua") -- executes worm
|
||||
```
|
||||
```xml
|
||||
@@ -47,10 +47,10 @@ Stops a currently running program
|
||||
#### Usage:
|
||||
* Stops worm by clicking a button
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local aProgram = mainFrame:addProgram("myFirstProgram"):show()
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aProgram = mainFrame:addProgram()
|
||||
aProgram:execute("rom/programs/fun/worm.lua") -- executes worm
|
||||
mainFrame:addButton("myFirstButton"):setText("Pause"):onClick(function() aProgram:stop() end):show()
|
||||
mainFrame:addButton():setText("Pause"):onClick(function() aProgram:stop() end):show()
|
||||
```
|
||||
|
||||
## pause
|
||||
@@ -65,9 +65,9 @@ pauses the current program (prevents the program from receiving events)
|
||||
#### Usage:
|
||||
* Pauses worm by clicking a button
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local aProgram = mainFrame:addProgram("myFirstProgram"):execute("rom/programs/shell.lua"):show()
|
||||
mainFrame:addButton("myFirstButton"):setText("Pause"):onClick(function() aProgram:pause(true) end):show()
|
||||
local mainFrame = basalt.createFrame():show()
|
||||
local aProgram = mainFrame:addProgram():execute("rom/programs/shell.lua"):show()
|
||||
mainFrame:addButton():setText("Pause"):onClick(function() aProgram:pause(true) end):show()
|
||||
```
|
||||
|
||||
## isPaused
|
||||
@@ -79,8 +79,8 @@ returns if the program is paused
|
||||
#### Usage:
|
||||
* Prints the pause status of the program
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local aProgram = mainFrame:addProgram("myFirstProgram"):execute("rom/programs/shell.lua"):show()
|
||||
local mainFrame = basalt.createFrame():show()
|
||||
local aProgram = mainFrame:addProgram():execute("rom/programs/shell.lua"):show()
|
||||
basalt.debug(aProgram:isPaused())
|
||||
```
|
||||
|
||||
@@ -101,9 +101,9 @@ injects a event into the program manually. For example you could inject w a s an
|
||||
#### Usage:
|
||||
* injects a event by clicking a button
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):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()
|
||||
local mainFrame = basalt.createFrame():show()
|
||||
local aProgram = mainFrame:addProgram():execute("rom/programs/shell.lua"):show()
|
||||
mainFrame:addButton():setText("inject"):onClick(function() aProgram:injectEvent("char", "w") end):show()
|
||||
```
|
||||
|
||||
## injectEvents
|
||||
@@ -119,15 +119,15 @@ Injects multiple events
|
||||
* injects a multiple char events by clicking a button
|
||||
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local aProgram = mainFrame:addProgram("myFirstProgram"):execute("rom/programs/shell.lua"):show()
|
||||
local mainFrame = basalt.createFrame():show()
|
||||
local aProgram = mainFrame:addProgram():execute("rom/programs/shell.lua"):show()
|
||||
|
||||
local events = {
|
||||
{event="char", args={"h"}},
|
||||
{event="char", args={"e"}},
|
||||
{event="char", args={"y"}}
|
||||
}
|
||||
mainFrame:addButton("myFirstButton"):setText("inject"):onClick(function() aProgram:injectEvents(events) end):show()
|
||||
mainFrame:addButton():setText("inject"):onClick(function() aProgram:injectEvents(events) end):show()
|
||||
```
|
||||
|
||||
|
||||
@@ -140,9 +140,9 @@ If the program is paused, incomming events will be inserted into a queued events
|
||||
#### Usage:
|
||||
* prints the queued events table
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):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()
|
||||
local mainFrame = basalt.createFrame():show()
|
||||
local aProgram = mainFrame:addProgram():execute("rom/programs/shell.lua"):show()
|
||||
mainFrame:addButton():setText("inject"):onClick(function() basalt.debug(aProgram:getQueuedEvents()) end):show()
|
||||
```
|
||||
|
||||
## updateQueuedEvents
|
||||
@@ -155,10 +155,10 @@ Here you can manipulate the queued events table
|
||||
1. `object` The object in use
|
||||
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local aProgram = mainFrame:addProgram("myFirstProgram"):execute("rom/programs/shell.lua"):show()
|
||||
local mainFrame = basalt.createFrame():show()
|
||||
local aProgram = mainFrame:addProgram():execute("rom/programs/shell.lua"):show()
|
||||
|
||||
mainFrame:addButton("myFirstButton"):setText("inject"):onClick(function()
|
||||
mainFrame:addButton():setText("inject"):onClick(function()
|
||||
local events = aProgram:getQueuedEvents()
|
||||
table.insert(events,1,{event="char", args={"w"}}
|
||||
aProgram:updateQueuedEvents(events)
|
||||
|
||||
@@ -1,122 +1,229 @@
|
||||
Radios are objects where you can create endless entrys the user can click on a button and it opens a "list" where the user can choose a entry
|
||||
Radios are objects which you can freely place, and the user is then able to select a single item.
|
||||
|
||||
Here is an example of how to create a standard radio:
|
||||
If you want to access values inside items this is how the table for single items is made (just a example):
|
||||
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local aRadio = mainFrame:addRadio("myFirstRadio"):show()
|
||||
item = {
|
||||
text="1. Entry",
|
||||
bgCol=colors.black,
|
||||
fgCol=colors.white
|
||||
args = {}
|
||||
}
|
||||
```
|
||||
|
||||
Here are all possible functions available for radios: <br>
|
||||
Remember Radio inherits from [Object](objects/Object.md)
|
||||
Remember Radios also inherits from [Object](objects/Object.md)
|
||||
|
||||
## addItem
|
||||
Adds a item to the radio
|
||||
|
||||
#### Parameters:
|
||||
1. `string` The entry name
|
||||
2. `number` x position
|
||||
3. `number` y position
|
||||
2. `number|color` unique default background color - optional
|
||||
3. `number|color` unique default text color - optional
|
||||
4. `any` any value - you could access this later in a :onChange() event (you need to use :getValue()) - optional
|
||||
|
||||
#### Returns:
|
||||
1. `object` The object in use
|
||||
|
||||
#### Usage:
|
||||
* Creates a default radio with 3 entries
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local aRadio = mainFrame:addRadio("myFirstRadio"):show()
|
||||
aRadio:addItem("1. Entry",3,4)
|
||||
aRadio:addItem("2. Entry",3,5,colors.yellow)
|
||||
aRadio:addItem("3. Entry",3,6,colors.yellow,colors.green)
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aRadio = mainFrame:addRadio()
|
||||
aRadio:addItem("1. Entry",5,2)
|
||||
aRadio:addItem("2. Entry",5,4,colors.yellow)
|
||||
aRadio:addItem("3. Entry",5,6,colors.yellow,colors.green)
|
||||
```
|
||||
```xml
|
||||
<radio>
|
||||
<item><text>1. Entry</text><x>5</x><y>2</y></item>
|
||||
<item><text>2. Entry</text><x>5</x><y>4</y><bg>yellow</bg></item>
|
||||
<item><text>3. Entry</text><x>5</x><y>6</y><bg>yellow</bg><fg>green</fg></item>
|
||||
</radio>
|
||||
```
|
||||
#### 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>
|
||||
|
||||
## removeItem
|
||||
Removes a item from the radio
|
||||
|
||||
#### Parameters:
|
||||
1. `number` The index which should get removed
|
||||
|
||||
#### Returns:
|
||||
1. `object` The object in use
|
||||
|
||||
#### Usage:
|
||||
* Creates a default radio with 3 entries and removes the second one.
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local aRadio = mainFrame:addRadio("myFirstRadio"):show()
|
||||
aRadio:addItem("1. Entry",3,4)
|
||||
aRadio:addItem("2. Entry",3,5,colors.yellow)
|
||||
aRadio:addItem("3. Entry",3,6,colors.yellow,colors.green)
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aRadio = mainFrame:addRadio()
|
||||
aRadio:addItem("1. Entry",5,2)
|
||||
aRadio:addItem("2. Entry",5,4,colors.yellow)
|
||||
aRadio:addItem("3. Entry",5,6,colors.yellow,colors.green)
|
||||
aRadio:removeItem(2)
|
||||
```
|
||||
#### Parameters: number index<br>
|
||||
#### Returns: self<br>
|
||||
|
||||
## editItem
|
||||
Edits a item on the radio
|
||||
Edits a item from the radio
|
||||
|
||||
#### Parameters:
|
||||
1. `number` The index which should be edited
|
||||
2. `string` The new item name
|
||||
3. `number` the new x position
|
||||
4. `number` the new y position
|
||||
3. `number|color` the new item background color - optional
|
||||
4. `number|color` The new item text color - optional
|
||||
5. `any` New additional information - optional
|
||||
|
||||
#### Returns:
|
||||
1. `object` The object in use
|
||||
|
||||
#### Usage:
|
||||
* Creates a default radio with 3 entries and changes the second one.
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local aRadio = mainFrame:addRadio("myFirstRadio"):show()
|
||||
aRadio:addItem("1. Entry",3,4)
|
||||
aRadio:addItem("2. Entry",3,5,colors.yellow)
|
||||
aRadio:addItem("3. Entry",3,6,colors.yellow,colors.green)
|
||||
aRadio:editItem(3,"3. Edited Entry",3,6,colors.yellow,colors.green)
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aRadio = mainFrame:addRadio()
|
||||
aRadio:addItem("1. Entry",5,2)
|
||||
aRadio:addItem("2. Entry",5,4,colors.yellow)
|
||||
aRadio:addItem("3. Entry",5,6,colors.yellow,colors.green)
|
||||
aRadio:editItem(2, "Still 2. Entry", 5, 4, colors.red)
|
||||
```
|
||||
#### Parameters: number index, string text, number x, number y, number bgcolor, number fgcolor, any ...<br>
|
||||
#### Returns: self<br>
|
||||
|
||||
## setScrollable
|
||||
Makes the radio scrollable
|
||||
## getItem
|
||||
Returns a item by index
|
||||
|
||||
#### Parameters:
|
||||
1. `number` The index which should be returned
|
||||
|
||||
#### Returns:
|
||||
1. `table` The item table example: {text="1. Entry", bgCol=colors.black, fgCol=colors.white}
|
||||
|
||||
#### Usage:
|
||||
* Creates a default radio with 3 entries and edits the second one.
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local aRadio = mainFrame:addRadio("myFirstRadio"):show()
|
||||
aRadio:addItem("1. Entry",3,4)
|
||||
aRadio:addItem("2. Entry",3,5,colors.yellow)
|
||||
aRadio:addItem("3. Entry",3,6,colors.yellow,colors.green)
|
||||
aRadio:setScrollable(true)
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aRadio = mainFrame:addRadio()
|
||||
aRadio:addItem("1. Entry",5,2)
|
||||
aRadio:addItem("2. Entry",5,4,colors.yellow)
|
||||
aRadio:addItem("3. Entry",5,6,colors.yellow,colors.green)
|
||||
basalt.debug(aRadio:getItem(2).text)
|
||||
```
|
||||
|
||||
## getItemCount
|
||||
Returns the current item count
|
||||
|
||||
#### Returns:
|
||||
1. `number` The item radio count
|
||||
|
||||
#### Usage:
|
||||
* Creates a default radio with 3 entries and prints the current item count.
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aRadio = mainFrame:addRadio()
|
||||
aRadio:addItem("1. Entry",5,2)
|
||||
aRadio:addItem("2. Entry",5,4,colors.yellow)
|
||||
aRadio:addItem("3. Entry",5,6,colors.yellow,colors.green)
|
||||
basalt.debug(aRadio:getItemCount())
|
||||
```
|
||||
|
||||
## getAll
|
||||
Returns all items as table
|
||||
|
||||
#### Returns:
|
||||
1. `table` All items
|
||||
|
||||
#### Usage:
|
||||
* Creates a default menubar with 3 entries and prints a table.
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aRadio = mainFrame:addRadio()
|
||||
aRadio:addItem("1. Entry",5,2)
|
||||
aRadio:addItem("2. Entry",5,4,colors.yellow)
|
||||
aRadio:addItem("3. Entry",5,6,colors.yellow,colors.green)
|
||||
basalt.debug(aRadio:getAll())
|
||||
```
|
||||
#### Parameters: boolean isScrollable<br>
|
||||
#### Returns: self<br>
|
||||
|
||||
## selectItem
|
||||
selects a item in the radio (same as a player would click on a item)
|
||||
|
||||
#### Parameters:
|
||||
1. `number` The index which should get selected
|
||||
|
||||
#### Returns:
|
||||
1. `object` The object in use
|
||||
|
||||
#### Usage:
|
||||
* Creates a default radio with 3 entries and selects the second entry.
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local aRadio = mainFrame:addRadio("myFirstRadio"):show()
|
||||
aRadio:addItem("1. Entry",3,4)
|
||||
aRadio:addItem("2. Entry",3,5,colors.yellow)
|
||||
aRadio:addItem("3. Entry",3,6,colors.yellow,colors.green)
|
||||
aRadio:selectItem(1)
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aRadio = mainFrame:addRadio()
|
||||
aRadio:addItem("1. Entry",5,2)
|
||||
aRadio:addItem("2. Entry",5,4,colors.yellow)
|
||||
aRadio:addItem("3. Entry",5,6,colors.yellow,colors.green)
|
||||
aRadio:selectItem(2)
|
||||
```
|
||||
#### Parameters: number index<br>
|
||||
#### Returns: self<br>
|
||||
|
||||
## clear
|
||||
clears the entire list (radio)
|
||||
Removes all items.
|
||||
|
||||
#### Returns:
|
||||
1. `object` The object in use
|
||||
|
||||
#### Usage:
|
||||
* Creates a default radio with 3 entries and removes them immediatley. Which makes no sense.
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local aRadio = mainFrame:addRadio("myFirstRadio"):show()
|
||||
aRadio:addItem("1. Entry",3,4)
|
||||
aRadio:addItem("2. Entry",3,5,colors.yellow)
|
||||
aRadio:addItem("3. Entry",3,6,colors.yellow,colors.green)
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aRadio = mainFrame:addRadio()
|
||||
aRadio:addItem("1. Entry",5,2)
|
||||
aRadio:addItem("2. Entry",5,4,colors.yellow)
|
||||
aRadio:addItem("3. Entry",5,6,colors.yellow,colors.green)
|
||||
aRadio:clear()
|
||||
```
|
||||
#### Parameters: -<br>
|
||||
#### Returns: self<br>
|
||||
|
||||
## getItemIndex
|
||||
returns the item index of the currently selected item
|
||||
|
||||
#### Returns:
|
||||
1. `number` The current index
|
||||
|
||||
#### Usage:
|
||||
* Creates a default radio with 3 entries selects the second entry and prints the currently selected index.
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local aRadio = mainFrame:addRadio("myFirstRadio"):show()
|
||||
aRadio:addItem("1. Entry",3,4)
|
||||
aRadio:addItem("2. Entry",3,5,colors.yellow)
|
||||
aRadio:addItem("3. Entry",3,6,colors.yellow,colors.green)
|
||||
aRadio:getItemIndex()
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aRadio = mainFrame:addRadio()
|
||||
aRadio:addItem("1. Entry",5,2)
|
||||
aRadio:addItem("2. Entry",5,4,colors.yellow)
|
||||
aRadio:addItem("3. Entry",5,6,colors.yellow,colors.green)
|
||||
aRadio:selectItem(2)
|
||||
basalt.debug(aRadio:getItemIndex())
|
||||
```
|
||||
#### Parameters: -<br>
|
||||
#### Returns: number index<br>
|
||||
|
||||
## setSelectedItem
|
||||
Sets the background of the item which is currently selected
|
||||
Sets the background and the foreground of the item which is currently selected
|
||||
|
||||
#### Parameters:
|
||||
1. `number|color` The background color which should be used
|
||||
2. `number|color` The text color which should be used
|
||||
|
||||
#### Returns:
|
||||
1. `object` The object in use
|
||||
|
||||
#### Usage:
|
||||
* Creates a default radio with 4 entries and sets the selection background color to green.
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame("myFirstFrame"):show()
|
||||
local aRadio = mainFrame:addRadio("myFirstRadio"):show()
|
||||
aRadio:addItem("1. Entry",3,4)
|
||||
aRadio:addItem("2. Entry",3,5,colors.yellow)
|
||||
aRadio:addItem("3. Entry",3,6,colors.yellow,colors.green)
|
||||
aRadio:setSelectedItem(colors.green, colors.blue)
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aRadio = mainFrame:addRadio()
|
||||
aRadio:addItem("1. Entry",5,2)
|
||||
aRadio:addItem("2. Entry",5,4,colors.yellow)
|
||||
aRadio:addItem("3. Entry",5,6,colors.yellow,colors.green)
|
||||
aRadio:addItem("4. Entry",5,8)
|
||||
aRadio:setSelectedItem(colors.green, colors.red)
|
||||
```
|
||||
#### Parameters: number bgcolor, number fgcolor, boolean isActive (isActive means if different colors for selected item should be used)<br>
|
||||
#### Returns: self<br>
|
||||
```xml
|
||||
<radio selectionBG="green" selectionFG="red">
|
||||
<item><text>1. Entry</text><x>5</x><y>2</y></item>
|
||||
<item><text>2. Entry</text><x>5</x><y>4</y><bg>yellow</bg></item>
|
||||
<item><text>3. Entry</text><x>5</x><y>6</y><bg>yellow</bg><fg>green</fg></item>
|
||||
</radio>
|
||||
```
|
||||
@@ -22,9 +22,9 @@ local function randomThreadFunction()
|
||||
end
|
||||
aThread:start(randomThreadfunction)
|
||||
```
|
||||
you are also able to start threads via xml:
|
||||
```lua
|
||||
basalt.setVariable("myThread", function() while true do os.sleep(1) end end)
|
||||
|
||||
```
|
||||
```xml
|
||||
<thread thread="myThread" start="true"/>
|
||||
|
||||
Reference in New Issue
Block a user