Merge pull request #59 from thesabinelim/patch-2
Add XML usage to schedule.md
This commit is contained in:
@@ -15,7 +15,7 @@ Schedules a function which gets called in a coroutine. After the coroutine is fi
|
|||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
* Creates a schedule which switches the color between red and gray
|
Creates a schedule which switches the color between red and gray:
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
local mainFrame = basalt.createFrame()
|
local mainFrame = basalt.createFrame()
|
||||||
@@ -34,3 +34,18 @@ aButton:onClick(basalt.schedule(function(self)
|
|||||||
self:setBackground(colors.gray)
|
self:setBackground(colors.gray)
|
||||||
end))
|
end))
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Usage in XML layout:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<button text="Click me">
|
||||||
|
<onClick>
|
||||||
|
basalt.schedule(function()
|
||||||
|
local button = event[1]
|
||||||
|
button:setBackground(colors.lime)
|
||||||
|
os.sleep(1)
|
||||||
|
button:setBackground(colors.black)
|
||||||
|
end)()
|
||||||
|
</onClick>
|
||||||
|
</button>
|
||||||
|
```
|
||||||
|
|||||||
Reference in New Issue
Block a user