Facility Control

 View Only
  • 1.  Disable Toggle Button

    Posted 10-08-2017 05:39
    Hi All:

    Does anyone know if it is possible to disable a Toggle Button via task? So, once toggled it would stay toggled until released by another task?

    Thanks!

    CJ


  • 2.  RE: Disable Toggle Button

    Ross Staff
    Posted 10-10-2017 20:24

    There are 2 mechanisms you can use for this.
    If your toggle button is a parameter, you can use params.setAccess(OID, 0) to disable the parameter and params.setAccess(OID, 1); to enable access.
    If you are using a non-parameter button, you can enable/disable with ogscript.setEnabled(ID, true/false);

    Here is a panel that demonstrates both techniques:

    <abs contexttype="opengear" style="">
       <meta>
          <params>
             <param access="1" constrainttype="INT_CHOICE" name="Toggle Button" oid="Toggle_Button" precision="0" type="INT32" value="0" widget="toggle">
                <constraint key="0">Off</constraint>
                <constraint key="1">On</constraint>
             </param>
          </params>
       </meta>
       <param expand="true" height="104" left="22" oid="Toggle_Button" style="style:toggleButton" top="38" width="238"/>
       <simplegrid height="56" left="20" rows="1" top="160" width="243">
          <button buttontype="push" name="Disable">
             <task tasktype="ogscript">params.setAccess('Toggle_Button', 0);</task>
          </button>
          <button buttontype="push" name="Enable">
             <task tasktype="ogscript">params.setAccess('Toggle_Button', 1);</task>
          </button>
       </simplegrid>
       <button buttontype="push" height="73" id="dis-button" left="31" name="Disable Me For 3" top="281" width="243">
          <task tasktype="ogscript">ogscript.setEnabled('dis-button', false);
    ogscript.asyncExec(function()
    {
       ogscript.setEnabled('dis-button', true);   
    }, 3000);</task>
       </button>
    </abs>

    #DashBoard


  • 3.  RE: Disable Toggle Button

    Posted 03-07-2024 07:53

    Found this post, and it was exactly what I was after.
    Question though, can you set a button as disabled by default?



    ------------------------------
    Aleksander Stalsberg
    Inland Norway University of Applied Sciences/Lillehammer Icehockey Club
    Norway
    ------------------------------



  • 4.  RE: Disable Toggle Button

    Posted 10-11-2017 17:29
    Great! Thanks James 😊
    #DashBoard