So, in vision, the multistate indicator works differently than in perspective. Perspective kind of shows the non-active states, whereas in vision it is all the same indicator just changes fill color/text based on binding.
In persepective I made added a property, as a Value, named "Controlindicator". I then bound it to an expression of a case statement that changes it from 0-4 based on a few PLC tags.
Then I made 5 new objects called States[0]-States[4] and added Values in each object for keys Value, Text, and FillColor.
I then bound the text output of the button to this:
CASE(
{this.props.ControlIndicator},
{this.props.States[0].Value}, {this.props.States[0].Text},
{this.props.States[1].Value}, {this.props.States[1].Text},
{this.props.States[2].Value}, {this.props.States[2].Text},
{this.props.States[3].Value}, {this.props.States[3].Text},
{this.props.States[4].Value}, {this.props.States[4].Text},
'ButtonBroke'
)
and I bound the Background color of the button to this:
CASE(
{this.props.ControlIndicator},
{this.props.States[0].Value}, {this.props.States[0].FillColor},
{this.props.States[1].Value}, {this.props.States[1].FillColor},
{this.props.States[2].Value}, {this.props.States[2].FillColor},
{this.props.States[3].Value}, {this.props.States[3].FillColor},
{this.props.States[4].Value}, {this.props.States[4].FillColor},
-1
)
So I effectively created a mutlistate button as it works in Vision.... or rather as I USED it in vision. I am sure there were other functionalities I was not using and as such did not create.
Can I save this as a Component somehow for re-use? Or would I just have to copy and paste in the future.
Thanks