Facility Control

 View Only
  • 1.  params.replaceConstraint - Fails if old and new constraint dimension do not match

    Posted 07-02-2025 18:32

    I am using the following lines:

          var newCon = params.createStringStringChoiceConstraint(channelList);
    params.replaceConstraint("channels", newCon);

    Where channelList is [{"key":"0","value":"Channel 0"},{"key":"1","value":"Channel 1"},{"key":"2","value":"Channel 2"}]

    If my parameter has 3 existing constraints, regardless of their key / value pairs, all is good and my constraints are updated

    However, if there are more or less than 3 existing constraints, it fails causing the panel to reload.

    Is this expected behaviour or am I doing something wrong?

    PS I could not find 'createStringStringChoiceConstraint' in the "CustomPanel Development Guide OGLML and ogScript Version 9.15" pdf.
    Is there a newer version of this guide?



    ------------------------------
    Richard Hills
    ------------------------------


  • 2.  RE: params.replaceConstraint - Fails if old and new constraint dimension do not match

    Posted 07-03-2025 06:06

    Additional:

    The issue seems to be related to the Widget hint I choose.  If I stick to 'Dropdown List (7)' all is fine.
    If I attempt to represent this as a series of buttons 'Toggle Buttons (19)' it fails!

    I have tried editing the 'Replacing Constraint Examples' panel and get the same result if in the first example 'String Choice Constraint'.
    I comment out one of the English constraints (English has 4, French has 5), and it now fails.

    What would be the correct way to represent a string choice (normally a dropdown list) as a grid of up to 16 buttons in a 4x4 arrangement?



    ------------------------------
    Richard Hills
    ------------------------------



  • 3.  RE: params.replaceConstraint - Fails if old and new constraint dimension do not match

    Posted 07-08-2025 21:21

    Hey Richard,

    This is definitely an annoying issue. I have made and attached 2 panels to display the problem you are facing and also the fix. To describe my understanding of the issue as best I can, it lies in with param widgets like 'Toggle Buttons (19)' or 'Radio Buttons (18)' where it draws multiple elements into the user interface for each option in the constraint if drawn right into a container like an abs it can make DashBoard unsure of how to redraw itself. I recommend using widgets like these in containers like the simplegrid or a table as they are better at handling this dynamic redrwaing of elements.

    Hope this helps.



    ------------------------------
    Antony Giraldo
    DashBoard Custom Panel Developer
    Ross Video Creative Services | Rocket Surgery Triggering and Control
    ------------------------------



  • 4.  RE: params.replaceConstraint - Fails if old and new constraint dimension do not match

    Posted 07-08-2025 21:25

    Not sure if the panels I attempted to attach went through correctly so here is the source code for both.

    Broken Panel:

    <abs contexttype="opengear" gridsize="20" id="_top" keepalive="false">
       <meta>
          <params>
             <param access="1" constraintstrict="false" constrainttype="STRING_STRING_CHOICE" maxlength="0" name="string_string" oid="string_string" type="STRING" value="g" widget="default">
                <constraint key="r">RED</constraint>
                <constraint key="g">GREEN</constraint>
                <constraint key="b">BLUE</constraint>
                <constraint key="a">ALPHA </constraint>
             </param>
          </params>
       </meta>
       <param expand="true" height="60" left="20" oid="string_string" showlabel="false" top="180" width="440"/>
       <param expand="true" height="60" left="20" oid="string_string" showlabel="false" top="260" widget="radio-toggle" width="440"/>
       <simplegrid height="80" hspace="2" left="20" top="60" width="960">
          <button buttontype="push" height="88" left="316" name="RGB" top="465" width="244">
             <task tasktype="ogscript">var newCon = params.createStringStringChoiceConstraint([
       {"key":"r", "value":"RED"},
       {"key":"g", "value":"GREEN"},
       {"key":"b", "value":"BLUE"}
    ]);
    params.replaceConstraint("string_string", newCon);</task>
          </button>
          <button buttontype="push" height="88" left="996" name="RGBA" top="747" width="244">
             <task tasktype="ogscript">var newCon = params.createStringStringChoiceConstraint([
       {"key":"r", "value":"RED"},
       {"key":"g", "value":"GREEN"},
       {"key":"b", "value":"BLUE"},
       {"key":"a", "value":"ALPHA "}
    ]);
    params.replaceConstraint("string_string", newCon);</task>
          </button>
          <button buttontype="push" height="88" left="1249" name="HSL" top="745" width="244">
             <task tasktype="ogscript">var newCon = params.createStringStringChoiceConstraint([
       {"key":"h", "value":"HUE"},
       {"key":"s", "value":"SATURATION"},
       {"key":"l", "value":"LIGHTNESS"}
    ]);
    params.replaceConstraint("string_string", newCon);</task>
          </button>
          <button buttontype="push" height="88" left="1498" name="HSLT" top="745" width="244">
             <task tasktype="ogscript">var newCon = params.createStringStringChoiceConstraint([
       {"key":"h", "value":"HUE"},
       {"key":"s", "value":"SATURATION"},
       {"key":"l", "value":"LIGHTNESS"},
       {"key":"t", "value":"TRANSPARENCY"}
    ]);
    params.replaceConstraint("string_string", newCon);</task>
          </button>
       </simplegrid>
       <label header="true" height="40" left="20" name="USE THESE TO UPDATE CONSTRAINT" style="txt-align:center" top="20" width="960"/>
       
       
       
    </abs>
    

    Fixed Panel:

    <abs contexttype="opengear" gridsize="20" id="_top" keepalive="false">
       <meta>
          <params>
             <param access="1" constraintstrict="false" constrainttype="STRING_STRING_CHOICE" maxlength="0" name="string_string" oid="string_string" type="STRING" value="g" widget="default">
                <constraint key="r">RED</constraint>
                <constraint key="g">GREEN</constraint>
                <constraint key="b">BLUE</constraint>
                <constraint key="a">ALPHA </constraint>
             </param>
          </params>
       </meta>
       <param expand="true" height="60" left="20" oid="string_string" showlabel="false" top="180" width="440"/>
       
       <simplegrid height="80" hspace="2" left="20" top="60" width="960">
          <button buttontype="push" height="88" left="316" name="RGB" top="465" width="244">
             <task tasktype="ogscript">var newCon = params.createStringStringChoiceConstraint([
       {"key":"r", "value":"RED"},
       {"key":"g", "value":"GREEN"},
       {"key":"b", "value":"BLUE"}
    ]);
    params.replaceConstraint("string_string", newCon);</task>
          </button>
          <button buttontype="push" height="88" left="996" name="RGBA" top="747" width="244">
             <task tasktype="ogscript">var newCon = params.createStringStringChoiceConstraint([
       {"key":"r", "value":"RED"},
       {"key":"g", "value":"GREEN"},
       {"key":"b", "value":"BLUE"},
       {"key":"a", "value":"ALPHA "}
    ]);
    params.replaceConstraint("string_string", newCon);</task>
          </button>
          <button buttontype="push" height="88" left="1249" name="HSL" top="745" width="244">
             <task tasktype="ogscript">var newCon = params.createStringStringChoiceConstraint([
       {"key":"h", "value":"HUE"},
       {"key":"s", "value":"SATURATION"},
       {"key":"l", "value":"LIGHTNESS"}
    ]);
    params.replaceConstraint("string_string", newCon);</task>
          </button>
          <button buttontype="push" height="88" left="1498" name="HSLT" top="745" width="244">
             <task tasktype="ogscript">var newCon = params.createStringStringChoiceConstraint([
       {"key":"h", "value":"HUE"},
       {"key":"s", "value":"SATURATION"},
       {"key":"l", "value":"LIGHTNESS"},
       {"key":"t", "value":"TRANSPARENCY"}
    ]);
    params.replaceConstraint("string_string", newCon);</task>
          </button>
       </simplegrid>
       <label header="true" height="40" left="20" name="USE THESE TO UPDATE CONSTRAINT" style="txt-align:center" top="20" width="960"/>
       <simplegrid cols="2" height="140" hspace="2" left="20" top="260" vspace="2" width="440">
          <param expand="true" height="60" left="20" oid="string_string" showlabel="false" top="300" widget="radio-toggle" width="620"/>
       </simplegrid>
       
       
    </abs>
    


    ------------------------------
    Antony Giraldo
    DashBoard Custom Panel Developer
    Ross Video Creative Services | Rocket Surgery Triggering and Control
    ------------------------------