- Docs Update

- Updated List & ScrollbarFrame Docs
- Added setOptions for the List Object
This commit is contained in:
Robert Jelic
2023-05-06 18:32:33 +02:00
parent e87557aba9
commit 2931a95c20
7 changed files with 104 additions and 30 deletions

View File

@@ -0,0 +1,22 @@
## getOptions
### Description
Returns all items as a table.
#### Returns
1. `table` All items
### Usage
* Creates a default list 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:getOptions())
```

View File

@@ -0,0 +1,35 @@
## setOptions
### Description
The `setOptions` method allows you to change the options of a List object. This method accepts a table containing the new options you want to set for the List object.
### Parameters
1. `table` A table containing the new options to set for the List object.
#### Returns
1. `object` The object in use
### Usage
* Creates a default list with 3 entries, then changes the background color and selection color of the list.
```lua
local mainFrame = basalt.createFrame()
local aList = mainFrame:addList()
aList:setOptions("Entry 1", "Entry 2", "Entry 3")
basalt.autoUpdate()
```
or
```lua
local mainFrame = basalt.createFrame()
local aList = mainFrame:addList()
aList:setOptions("Entry 1", {"Entry 2", colors.yellow}, {"Entry 3", colors.yellow, colors.green})
basalt.autoUpdate()
```

View File

@@ -1,28 +0,0 @@
## setSelectedItem
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()
local aList = mainFrame:addList()
aList:addItem("1. Entry")
aList:addItem("2. Entry",colors.yellow)
aList:addItem("3. Entry",colors.yellow,colors.green)
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>
```

View File

@@ -24,7 +24,7 @@ aList:addItem("1. Entry")
aList:addItem("2. Entry",colors.yellow)
aList:addItem("3. Entry",colors.yellow,colors.green)
aList:addItem("4. Entry")
aList:setSelectedItem(colors.green, colors.red)
aList:setSelectionColor(colors.green, colors.red)
```
```xml