Facility Control

 View Only
  • 1.  Detect button push

    Posted 05-06-2016 10:00
    Hi,

    I'm trying to implement a Push To Talk button in Dashboard to control a talkback system. The ogscript task on a pushbutton gets fired when the button is released, is there any way to fire a task as a button is pushed too?


  • 2.  RE: Detect button push

    Posted 05-06-2016 13:38

    Hi Martin.
    There are 2 fairly easy ways of getting here:
    1. Attach handlers for onmousedown and onmouseup to your button through blocks instead of using the tasks directly inside of the buttons:

    <ogscript handles="onmousedown" targetid="my-button">ogscript.debug('down script goes here');</ogscript>
    <ogscript handles="onmouseup" targetid="my-button">ogscript.debug('up script goes here');</ogscript>
    <button buttontype="push" height="92" id="my-button" left="40" top="56" width="122"/>

    2.Use a toggle button parameter with the w.immediate=true property will cause the toggle button to immediately pop back up when the user releases the mouse:

    <abs contexttype="opengear" style="">
    <meta>
    <params>
    <param access="1" constrainttype="INT_CHOICE" name="Toggle" oid="Toggle" precision="0" type="INT32" value="0" widget="toggle">
    <config key="w.instantoff">true</config>
    <constraint key="0">Off</constraint>
    <constraint key="1">On</constraint>
    </param>
    </params>
    </meta>
    <param expand="true" height="64" left="21" oid="Toggle" style="style:toggleButton;" top="20" width="122">
    <task tasktype="ogscript">ogscript.debug("MY VALUE IS: " + this.getValue());</task>
    </param>
    </abs>

    #DashBoard


  • 3.  RE: Detect button push

    Posted 05-06-2016 19:04
    Hi James,

    thank you so much, this is exactly what I was looking for. I think the first method is the one I'll use, I'll let you know how it goes.

    All the best,
    Martin
    #DashBoard