Facility Control

 View Only
  • 1.  Change parameter widget attribute

    Posted 05-02-2019 11:02

    So, what I'm looking to do is to have a series of parameters shown in read-only text fields.
    However, I also want a toggle button that says "edit" that when pressed, changes all these inputs (I assume they would need IDs) into text-input fields.

    Is this possible?
    I am aware of the ogscript.setStyle('id', 'bg#ff0000'); to make it a red background for example, or set an image background, is there something similar for widget/attribute?

    I am also aware of the Element.setAttribute variant in JavaScript.
    https://developer.mozilla.org/en-US/docs/Web/API/Element/setAttribute



  • 2.  RE: Change parameter widget attribute

    Posted 05-02-2019 20:18

    You don't need to change the widget hint - you just need to set the parameter's "access" property:

    <abs contexttype="opengear" id="_top" style="">
    <meta>
    <params>
    <param access="1" maxlength="0" name="My Parameter" oid="My_Parameter" type="STRING" value="" widget="text"/>
    <param access="1" constrainttype="INT_CHOICE" name="Parameter Access" oid="Parameter_Access" precision="0" type="INT32" value="0" widget="toggle">
    <constraint key="0">Editable</constraint>
    <constraint key="1">Editable</constraint>
    </param>
    </params>
    </meta>
    <param expand="true" height="77" left="29" oid="My_Parameter" top="27" width="334"/>
    <param expand="true" height="87" left="373" oid="Parameter_Access" runtasksonload="true" style="style:toggleButton;" top="22" width="128">
    <task tasktype="ogscript">if (this.getValue() == 0)
    {
    params.setAccess('My_Parameter', 0); //0 = read only, 1 = read/write
    }
    else
    {
    params.setAccess('My_Parameter', 1); //0 = read only, 1 = read/write
    }
    </task>
    </param>
    </abs>

    #DashBoard


  • 3.  RE: Change parameter widget attribute

    Posted 05-05-2019 18:36

    Hmmmm, yes I see what you did James and I sorta like it. Instead of changing the actual widget, you change the parameter instead and the widget reflects that.

    It works, and yes, I can definetly use it in some cases...
    It's not quite what I'm after though.

    My DashBoard contains hundreds of parameters and cross points and tables and god knows what else now...
    To organize it, and to be better able to see what I'm actually sending through DataLinq and more easilly manipulate that data, I've made a tab in my DashBoard where I just gather all the parameters I'm actually using again in the other end in Xpression.
    And on this tab they're all read-only. However it would be cool to be able to turn "edit" on, and then change these widgets from read only to editable.

    So these parameters here in read-only has a second widget somewhere in the DashBoard, but this is just a "view" of them all.
    So editing the parameter is not really what I'm after...


    #DashBoard


  • 4.  RE: Change parameter widget attribute

    Posted 05-06-2019 17:39

    While a widget can be created with readonly="true" as an attribute, there is no mechanism to change this on the view or a parameter via script - it can only be set at the parameter level.

    One workaround you could use is to have all of your parameters inside of <tab/> controls with the tabs hidden. You could have one tab containing the editable version and another tab containing the read-only version. To switch between editable and read-only, you would just reveal the appropriate tab.


    #DashBoard