MultiState Button in Perspective not working

Im trying to use a multi state button in my view and when i press on it it doesn't change states. From my understading after reading the documentation for this component, when one of the states is pressed, the control value is changed to the value of the pressed state. However, this is not the case in my view and im at a loss as for what could be causing this to happen. I dont know if its a version wide issue or just some wrong setting on my project. Any help would be wonderful!

Multistate button

It should just work. For the animation I just dropped a Multistate Button component on the view and turned on Preview Mode. Note the controlValue changing.

In the spirit of, "Did you try turning it off and on again?", try saving the project, closing the view and reopening.

What is very likely occurring is that you have not updated the indicatorValue value to the match the controlValue value. The front-end of the Multi-State Button does not mirror the controlValue value; in order to update the display state, the indicatorValue must be updated in some way to let the user know what state should be displayed. My uses almost always bind indicatorValue to controlValue, but there are use cases which require special state handling and confirmation of bit reads before then updating the indicatorValue.

TLDR:
controlValue = "this is what my value is when a user clicks a button."
indicatorValue = "This is what state I display to the user as the current state after I've confirmed that I haven indeed set the state of the PLC/Machine/Device."

1 Like

Hey thanks for the fast replies, sasdly i already did those things. I tried opening a new project and it works fine on that one but when i try on the one i need to modify, the control value doesnt ever change. Are there view or root params that can alter how a button functions? I'm really lost as to what would cause this.

Right-click on the button in Designer and copy.
Paste in here and format it as code as shown in Wiki - how to post code on this forum.
Then we can examine it.

[
  {
    "type": "ia.input.multi-state-button",
    "version": 0,
    "props": {
      "states": [
        {
          "text": "Ligne 1",
          "value": 1,
          "selectedStyle": {
            "classes": "",
            "backgroundColor": "#8AFF8A"
          },
          "unselectedStyle": {
            "classes": ""
          }
        },
        {
          "selectedStyle": {
            "backgroundColor": "#8AFF8A",
            "classes": ""
          },
          "text": "Ligne 2",
          "unselectedStyle": {
            "classes": ""
          },
          "value": 2
        },
        {
          "selectedStyle": {
            "backgroundColor": "#8AFF8A",
            "classes": ""
          },
          "text": "Ligne 3",
          "unselectedStyle": {
            "classes": ""
          },
          "value": 3
        },
        {
          "selectedStyle": {
            "backgroundColor": "#8AFF8A",
            "classes": ""
          },
          "text": "Ligne 4",
          "unselectedStyle": {
            "classes": ""
          },
          "value": 4
        }
      ],
      "orientation": "row",
      "defaultSelectedStyle": {
        "classes": "Menu/Item_Selected"
      },
      "controlValue": 1
    },
    "meta": {
      "name": "MultiStateButton"
    },
    "position": {
      "x": 34.91,
      "y": 6.72,
      "height": 35,
      "width": 383
    },
    "custom": {},
    "propConfig": {
      "props.indicatorValue": {
        "binding": {
          "type": "property",
          "config": {
            "path": "this.props.controlValue"
          }
        }
      }
    }
  }
]

Multistate button horizontal

I pasted it into a view and it all works just fine.

Are you 100% sure that you don't have a script writing to props.controlValue somewhere / somehow.

1 Like

Ill look into it too it works fine on another project for me too. Thank you for the guidance!

Quick question, is there any way to see all the places that communicate to a certain property or tag during runtime within perpective, i know of a way to do so in Vision but not perspective and it would be really helpful to find out whats communicating at runtime.

Other than using Ctrl-F to find it, no, I don't.

You could, for a test, try changing the name of the component in the Project Browser by one or two characters so that anything writing to it won't find it.