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
|
||||
|
||||
* Creates a schedule which switches the color between red and gray
|
||||
Creates a schedule which switches the color between red and gray:
|
||||
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
@@ -34,3 +34,18 @@ aButton:onClick(basalt.schedule(function(self)
|
||||
self:setBackground(colors.gray)
|
||||
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