Hi there,
I'm stuck on what should be a fairly basic scripting issue, I'm trying to show and hide an image based on states in toggle button.
Bascially the toggle button is setting a global lock state in another contorl system and i want the image to appear and disappear based on the lock state:
<param expand="true" gpi="LOCK1trigger" height="173" left="85" oid="Test" style="style:toggleButton;" top="150" width="554">
<task tasktype="ogscript">ogscript.debug(this.getValue() );</task>
<task tasktype="ogscript">var state = null; //event.getBytesAsString();
if (event.getState && event.getState() != null)
{
state = event.getState();
if (state == 0) this.setValue(1);
if (state == 1) this.setValue(0);
}</task>
<task tasktype="ogscript">switch (this.getValue())
{
case 0:
rosstalk.sendMessage('192.168.0.3',24601,'DoEvent= C_LOCK-1');(ogscript.setStyle('[flogo]', '[style.display='none']'));
break;
case 1:
rosstalk.sendMessage('192.168.0.3',24601,'DoEvent= C_UNLOCK-1');(ogscript.setStyle('[flogo]', '[style.display='visible']'));
break;
}</task>
</param>
Any thoughts on this would be greatly appreciated.
many thanks.