Facility Control

 View Only
  • 1.  Trigger toggle button state with other buttons

    Posted 02-10-2020 15:41

    I've tried to search the forum and piece together what I need to accomplish this, but I keed hitting dead ends.

    I am trying to build a panel with toggle buttons in 2 categories, Show and Monitor, and regular buttons in a Fill category.

    First goal, build a strip of toggle buttons in the "Show" category where toggling/activating a show button will deactivate all other buttons in the category. Additionally, deactivating the active show button will activate an "Auto" show button by default. The active button will set a string value.

    The "Monitor" category buttons will behave similarly to the "Show" category.

    The "Fill" category buttons, when clicked on, will use the string values associated with the active buttons in the other two categories to complete a concatenated string value and ultimately trigger a Take ID in XPression (specifically Tessera) using RossTalk.

    Here's an image of my layout to hopefully clear up the intent of the panel. Can this be done this way or do I need to adjust my approach? TIA



  • 2.  RE: Trigger toggle button state with other buttons

    Posted 02-10-2020 16:29

    Hi Josh,

     

    This can definitely be done! 

    For your "Show" and "Monitor" buttons, there are I suggest using parameters. I've attached code for an example panel at the bottom.

     

    Use a String or Integer parameter with a constraint. I suggest a String with Key/Value constraint.

    Set the "value" column of your constraint to be the values your "Fill" buttons will be using to concatenate, and the "name" column to the display names you want the button to have. For example, the 12 PM button may use a value of "12" and a name of "12 PM".

    Furthermore, you can add styling to each button by adding a style tag to the name. Using our "12 PM" button as an example, the name could be "12 PM<bg#FF0000>", where "bg" represents the background color of the button.

    Set your widget hint to "Toggle Buttons", and hit "Commit Changes", and then "Done". Using the param tool, place your param in your panel and you should see something like this:

    With these buttons, only one can be selected a time, and the parameter value is the "value" of whichever button is currently selected. The only downside with this method is you can't deactivate the selected button. With this, you would simply click the "AUTO" button to use the default mode.

     

    This also makes your "FILL" section easier, as you can use params.getValue(YOUR PARAM OID, 0); to get the value of the currently selected button.

    CODE SNIPPET

    <abs contexttype="opengear" gridsize="20" id="_top" keepalive="false" style="">
    <meta>
    <params>
    <param access="1" constraintstrict="false" constrainttype="STRING_STRING_CHOICE" maxlength="0" name="Show Time" oid="param.showTime" type="STRING" value="9" widget="radio-toggle">
    <constraint key="9">9 AM&lt;bg#00ff00;&gt;</constraint>
    <constraint key="12">12 PM&lt;bg#ff0000;&gt;</constraint>
    <constraint key="15">3 PM&lt;bg#panelbg;&gt;</constraint>
    <constraint key="18">6 PM&lt;bg#111111;&gt;</constraint>
    <constraint key="0">AUTO&lt;bg#ffff00;&gt;</constraint>
    </param>
    </params>
    </meta>
    <param expand="true" height="100" left="120" oid="param.showTime" showlabel="false" style="t:bg#selectbg;" top="80" width="700"/>
    </abs>

     

    Does that help? Let me know if you have any more questions! 

    Kyle


    #DashBoard


  • 3.  RE: Trigger toggle button state with other buttons

    Posted 02-11-2020 15:19


  • 4.  RE: Trigger toggle button state with other buttons

    Posted 02-11-2020 15:22

    Already making a ton of progress with the information you guys have given. I'll update if any other issues come up and post about the final result 👍


    #DashBoard