-
FEATURED COMPONENTS
First time here? Check out the FAQ!
How can I create a timer so that it is updated vbox and to be able to change the icon depending on the status? Now I have it like in the example, but I don´t know it must be "updateVox" Example:
<vbox id="statusSystemVbox">
<button
src="/img/64/iconoActualizar64.png"
onClick="@command('openWindow')">
</button>
<button id="isStatusStopButton"
src="/img/64/iconoPlay64Verde.png"
onClick="@command('activeSystem', status='STOP')"
if="${vm.isStatusSystem == true}">
</button>
<button id="isStatusStartButton"
src="/img/64/iconoPlay64Rojo.png"
onClick="@command('activeSystem', status='PLAY')"
if="${vm.isStatusSystem == false}">
</button>
</vbox>
<timer id="timerVbox"
delay="${labels.timer.time}" repeats="true"
onTimer="@command('updateVbox')" />
In your command updateVbox
you shall notify all the things that could have changed.
Bind the source of your images to your vm.
Like this :
@Command
@NotifyChanged ({"isStatusSystem","sourceIcon"})
public void updateVbox () {
// change here the source if it must be changed.
}
edit :
<button src="@load(vm.sourceIcon)" onClick="@command('openWindow')">
or when it's in an other object and where only that object has a getter :
<button src="@load(vm.object.sourceIcon)" onClick="@command('openWindow')">
Asked: 2014-03-26 10:04:22 +0800
Seen: 15 times
Last updated: Mar 26 '14