docs updates

This commit is contained in:
Robert Jelic
2022-09-06 17:43:03 +02:00
parent 4d227af9d9
commit 51f6ebe7ce
15 changed files with 630 additions and 22 deletions

View File

@@ -14,7 +14,7 @@ Changes the background color while the animation is running
```lua
local mainFrame = basalt.createFrame()
local testButton = mainFrame:addButton("buttonToAnimate")
local aAnimation = mainFrame:addAnimation():setObject(testButton):changeBackground({colors.red, colors.yellow, colors.green}, 2):play()
local aAnimation = mainFrame:addAnimation():setObject(testButton):changeTextColor(2, 0, colors.red, colors.yellow, colors.green):play()
```
```xml
<animation object="buttonToAnimate" play="true">
@@ -25,4 +25,4 @@ local aAnimation = mainFrame:addAnimation():setObject(testButton):changeBackgrou
<duration>2</duration>
</background>
</animation>
```
```

View File

@@ -14,7 +14,7 @@ Changes the text while animation is running
```lua
local mainFrame = basalt.createFrame()
local testButton = mainFrame:addButton("buttonToAnimate")
local aAnimation = mainFrame:addAnimation():setObject(testButton):changeText({"i", "am", "groot"}, 2):play()
local aAnimation = mainFrame:addAnimation():setObject(testButton):changeText(2, 0, "i", "am", "groot"):play()
```
```xml
<animation object="buttonToAnimate" play="true">

View File

@@ -14,7 +14,7 @@ Changes the text color while the animation is running
```lua
local mainFrame = basalt.createFrame()
local testButton = mainFrame:addButton("buttonToAnimate")
local aAnimation = mainFrame:addAnimation():setObject(testButton):changeTextColor({colors.red, colors.yellow, colors.green}, 2):play()
local aAnimation = mainFrame:addAnimation():setObject(testButton):changeTextColor(2, 0, colors.red, colors.yellow, colors.green):play()
```
```xml
<animation object="buttonToAnimate" play="true">

View File

@@ -24,13 +24,13 @@ end)
and this would be the xml way:
```lua
local main = basalt.createFrame():addLayout("example.xml")
basalt.setVariable("buttonClick", function(self,event,button,x,y)
if(event=="mouse_click")and(button==1)then
basalt.debug("Left mousebutton got clicked!")
end
end)
local main = basalt.createFrame():addLayout("example.xml")
```
```xml
<button onClick="buttonClick" text="Click" />

View File

@@ -0,0 +1,18 @@
## setSymbol
Changes the checkbox symbol, default is "\42"
#### Parameters:
1. `string` symbol
#### Returns:
1. `object` The object in use
#### Usage:
* Creates a new checkbox and changes the symbol to o
```lua
local main = basalt.createFrame()
local checkbox = main:addCheckbox():setSymbol("o")
```
```xml
<checkbox symbol="o" />
```

View File

@@ -1,8 +1,5 @@
## removeFocusedObject
Removes the focus of the supplied object
#### Parameters:
1. `object` The child object to remove focus from
Removes the currently focused object of that frame
#### Returns:
1. `frame` The frame being used
@@ -10,7 +7,9 @@ Removes the focus of the supplied object
#### Usage:
* Creates a new button then removes the focus from that button when clicking on it
```lua
local aButton = myFrame:addButton():setFocus():onClick(function()
myFrame:removeFocusedObject(aButton)
local main = basalt.createFrame()
local input = main:addInput():setFocus()
local aButton = main:addButton():onClick(function()
main:removeFocusedObject()
end)
```

View File

@@ -2,7 +2,7 @@
Removes a child object from the frame
#### Parameters:
1. `string` The name of the child object
1. `string|object` The name of the child object or the object itself
#### Returns:
1. `boolean` Whether the object with the given name was properly removed
@@ -10,6 +10,9 @@ Removes a child object from the frame
#### Usage:
* Adds a button with the id "myFirstButton", then removes it with the aforementioned id
```lua
myFrame:addButton("myFirstButton")
myFrame:removeObject("myFirstButton")
local main = basalt.createFrame()
main:addButton("myFirstButton"):setText("Close")
:onClick(function(self)
main:removeObject("myFirstButton") -- or main:removeObject(self)
end)
```

View File

@@ -10,7 +10,7 @@ loads a default .nfp file into the object.
#### Usage:
* Creates a default image and loads a test.nfp file
```lua
local mainFrame = basalt.createFrame():show()
local mainFrame = basalt.createFrame()
local aImage = mainFrame:addImage():loadImage("test.nfp")
```
```xml

View File

@@ -0,0 +1,5 @@
## getBackground
Returns the current background color
#### Returns:
1. `number` color

View File

@@ -0,0 +1,5 @@
## getForeground
Returns the current foreground color
#### Returns:
1. `number` color

View File

@@ -0,0 +1,11 @@
## remove
Removes the object from it's parent frame. This won't 'destroy' the object, It will continue to exist as long as you still have pointers to it.
Here is a example on how a button will be fully removed from the memory:
```lua
local main = basalt.createFrame()
local button = main:addButton():setPosition(2,2):setText("Close")
button:remove()
button = nil
```

View File

@@ -4,9 +4,9 @@ Scrollbars are objects, the user can scroll vertically or horizontally, this wil
| | |
|---|---|
|[setSymbol](objects/Scrollbar/setSymbol.md)|Sets the scrollbar symbol
|[setBackgroundSymbol](objects/Scrollbar/setBackgroundSymbol.md)|Sets the background symbol
|[setBarType](objects/Scrollbar/setBarType.md)|Sets the bar type (vertical or horizontal)
|[setMaxValue](objects/Scrollbar/setMaxValue.md)|Sets the maximum value
|[setIndex](objects/Scrollbar/setIndex.md)|Sets the current index
|[getIndex](objects/Scrollbar/getIndex.md)|Returns the index
|[setSymbol](objects/Slider/setSymbol.md)|Sets the slider symbol
|[setBackgroundSymbol](objects/Slider/setBackgroundSymbol.md)|Sets the background symbol
|[setBarType](objects/Slider/setBarType.md)|Sets the bar type (vertical or horizontal)
|[setMaxValue](objects/Slider/setMaxValue.md)|Sets the maximum value
|[setIndex](objects/Slider/setIndex.md)|Sets the current index
|[getIndex](objects/Slider/getIndex.md)|Returns the index