Facility Control

 View Only
  • 1.  number pad to multiple paramaters

    Posted 11-20-2016 20:26
    im trying to build a interface that can fully run a score bug off the back channel with out using with the main xpresion computer as much. what im having trouble scripting is how to make a number pad in dashboard be able to work with multiple params by selecting them. i already have the number working just need help connecting it to the params

    any ideas?


  • 2.  RE: number pad to multiple paramaters

    Posted 11-21-2016 18:36
    Do you mean you want to make it update multiple params simultaneously or do you mean you want to make it so it can re-target which single parameter it is working on?

    If you're trying to re-target, you could use an onclick or onmousedown script and call ogscript.putObject('MY_ACTIVE_PARAM', 'OID_OF_PARAM_TO_UPDATE'); and then use var oidTouse = ogscript.getObject('MY_ACTIVE_PARAM'); when you're applying your punchpad changes.

    If you're trying to select multiple, I would recommend an integer array of toggle buttons (or check boxes) you could put beside each param you wish to update. You could then check the status of each checkbox when applying your punchpad changes to see if you should update each param.

    If you need an example of what I'm talking about, let me know which approach you're trying to do and I'll see what I can do.

    Best of luck.

    James
    #DashBoard


  • 3.  RE: number pad to multiple paramaters

    Posted 11-22-2016 02:08

    i think your right with what i want to do. (click the param then type the Numbers) im not the best script writer but i good at reading and editing it. where would i need to put those lines of codes to make it work?
    the number pad i use is also probably not a normal one. i got it off of another project i had here is a keys line.

    <button buttontype="push" colspan="1" fill="both" height="40" name="7" rowspan="1" style="bdr#dark;size:20;font:bold;txt-align:center;" weightx="1.0" weighty="1.0" width="50">
    <task tasktype="ogscript">var value=params.getValue('KeyboardValue',0);

    if (value.length &gt;= 2)
    value = value.substring(1,2);

    value += '7';

    params.setValue('KeyboardValue',0,value);</task>
    </button>

    #DashBoard


  • 4.  RE: number pad to multiple paramaters

    Posted 11-22-2016 14:30

    I've taken the logic to select the parameter and to add values from your punch pad and put them in an tag. This keeps the logic of the panel in one spot and makes the rest of the UI much easier to work with (and change if necessary). The key parts are the functions "selectParam" and "addValue". Note that I also specify an id attribute for each tag where it appears in the UI so I can change the border colour when it is selected.

    <abs contexttype="opengear">
       <meta>
          <params>
             <param access="1" maxlength="0" name="Param 1" oid="Param_1" type="STRING" value="" widget="text"/>
             <param access="1" maxlength="0" name="Param 2" oid="Param_2" type="STRING" value="" widget="text"/>
          </params>
          <api>var paramList = ["Param_1", "Param_2"];
    function selectParam(oid)
    {
       for (var i = 0; i &lt; paramList.length; i++)
       {
          if (oid != paramList[i])
          {
             ogscript.setStyle("id_for_" + paramList[i], "bdr#000000");
          }
          else
          {
             ogscript.setStyle("id_for_" + paramList[i], "bdr#selectbg");
          }
       }
    
       ogscript.putObject("SelectedParam", oid);
    }
    
    function addValue(valueToAdd)
    {
       var selectedParam = ogscript.getObject("SelectedParam");
       if (selectedParam == null)
       {
          return;
       }
    
       var value=params.getValue(selectedParam,0);
    
       if (value.length &gt;= 2)
       {
          value = value.substring(1,2);
       }
       value += valueToAdd;
       
       params.setValue(selectedParam, 0, value);
    }
    </api>
       </meta>
       <button buttontype="push" colspan="1" fill="both" height="40" left="242" name="7" rowspan="1" style="bdr#dark;size:20;font:bold;txt-align:center;" top="338" weightx="1.0" weighty="1.0" width="50">
          <task tasktype="ogscript">addValue('7');
    </task>
       </button>
       <param expand="true" height="87" id="id_for_Param_1" left="20" oid="Param_1" onmousedown="selectParam('Param_1');" style="bdr:thick;" top="19" width="224"/>
       <param expand="true" height="84" id="id_for_Param_2" left="257" oid="Param_2" onmousedown="selectParam('Param_2');" style="bdr:thick;" top="20" width="218"/>
    </abs>

    #DashBoard


  • 5.  RE: number pad to multiple paramaters

    Posted 11-28-2016 00:33
    thanks worked perfectly for what I was looking for. now that I have done a show with it I want to see if there is a easy way to change how the key board types in. because basket ball needs to be able to type something like 12-15 I need to be able to type that in to some of the parameter as well as a % in some. do you have a suggestions on how to change the number pad to allow this
    #DashBoard


  • 6.  RE: number pad to multiple paramaters

    Posted 11-28-2016 15:36

    You can put anything you want to access into ogscript.putObject and access it with ogscript.getObject.
    Right now, we put a variable called "SelectedParam". I would suggest adding another putObject so specify the format you want.

    function selectParam(oid, format)
    {
       for (var i = 0; i &lt; paramList.length; i++)
       {
          if (oid != paramList[i])
          {
             ogscript.setStyle("id_for_" + paramList[i], "bdr#000000");
          }
          else
          {
             ogscript.setStyle("id_for_" + paramList[i], "bdr#selectbg");
          }
       }
    
       ogscript.putObject("SelectedParam", oid);
       ogscript.putObject("ParamFormat", format);
    }

    You can then use

    var format = ogscript.getObject("ParamFormat");

    inside of your number pad code to make it do what you need it to do.


    #DashBoard