SwitchList
This complex component allows to define a set of branches that can be activated one after the other.
Constructor
SwitchList <id> (bool loop) {
Component <id> {...}
...
}
The branches of a SwitchList are classic components, that is containers to which any kind of processes can be added. The SwitchList has three predefined children: next
, previous
, index
that allow to activate a new branch, respectively, the next, the previous or the one designated by the index. In each case, the current branch is deactivated and the new one is activated. If the loop argument is set to true
, the next and previous signals will loop over the branches.
Warning
A switch list branch can't have loop, next, previous
or index
as a name
Action
Activates the fist branch of the SwitchList.Predefined children
- BoolProperty:
loop
specifies if the switch can loop over its branches. - Spike:
next
goes to the next branch. - Spike:
previous
goes to the previous branch. - IntProperty:
index
goes to the branch designated by the value of index.
Example
use core
use base
use gui
_main_
Component root {
Frame f ("myButton", 0, 0, 500, 500)
Exit quit (0, 1)
f.close->quit
SwitchList blink (1) {
Component _ {
FillColor red (255, 0, 0)
Rectangle r (0, 0, 100, 70, 0, 0)
}
Component _ {
FillColor green (0, 255, 0)
Rectangle r (0, 0, 100, 70, 0, 0)
}
}
Clock cl (500)
cl.tick->blink.next
}