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
------------------------------
Original Message:
Sent: 10-10-2017 20:24
From: James Peltzer
Subject: Disable Toggle Button
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