Facility Control

 View Only
  • 1.  Show/hide image in dashboard

    Posted 04-13-2016 00:15

    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 &amp;&amp; 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.



  • 2.  RE: Show/hide image in dashboard

    Posted 04-20-2016 14:18
    One thing to keep in mind is that ogScript and OGLML are not exactly the same as JavaScript or HTML.

    With OGLML, you can hide/show elements that reside directly within an tag. We change the visible state with a call of ogscript.hide('flogo'); or ogscript.reveal('flogo');

    For setting the style of a label, button, etc., you can set/remove a background image with ogscript.setStyle('flogo', 'bg-u:URL-OF-THE-IMAGE'); and remove with (ogscript.setStyle('flogo', 'bg-remove:none');

    Hope this helps you onto the right track. If you have further questions, just ask.
    #DashBoard


  • 3.  RE: Show/hide image in dashboard

    Posted 04-22-2016 02:16
    Ahh perfect - that's got it. Thanks mate!
    #DashBoard


  • 4.  RE: Show/hide image in dashboard

    Posted 04-22-2016 13:43
    No worries.
    Glad to help!
    #DashBoard