Multi-State Button - Making Confirm text dynamic

Hi there, can anyone help me how to change the confirmation text depending on the button clicked on multi-state button.

I have a multi-state button that has 3 states Manual =2,Off =0, and Auto=1.

I would like
a confirmation message “Are you sure you want to switch to Manual mode?” to popup when selecting Manual button

a confirmation message “Are you sure you want to switch to Auto mode?” to popup when selecting Auto button

a confirmation message “Are you sure you want to switch off the machine?” to popup when selecting Off button.

You need to use python to do this. Set up your confirmation how you normally would, then click on the scripting tab. You should now have a basis to work from.

As a hint, you’d use something like:

msg = 'are you sure you want to switch to %s mode?' 
if event.source.state == 0:
   msg = msg % 'Off' 

I’m not at my desk, so sorry for the somewhat vague reply

Awesome :slight_smile:
I will try scripting the tab.

hey hello ,
i have a doubt related to multistate button
I have a machine udt defined and there are some instances of the udt . i have a multi state button to control the machine in a template . I have binded the control value and indicator value of the multistate button to the machine status tag. When i am changing the state using multistate button the machine status tag gets changed but the machine still remains on .its like i am not able to control the machine
The Multi-State button on my Machine template seems to reflect the Machine’s current status, but clicking the button doesn’t seem to change the Machine’s state even though tag gets changed…
Could anyone help me out with this

This should be a new topic as it’s completely irrelevant to this one… Have you set the binding to bidirectional?

2 Likes

Yup ! Binding is set to bidirectional, and sorry about the new topic. I was so involved that i forgot to create a new topic for this.

I should clarify, is the Control property the only property bound bidirectionally?

I read your first post again: you’re saying that when you press the multistate button, the tag you’ve bound to the control property changes value, but the status of the multistate indicator doesn’t?
Are these the same tags or are they independent? If independent, then the issue lies in the PLC. If the same tag for control and indication, then it would seem there’s an issue in your indicator property binding - make sure this is not set to bidirectional.

Thank you Nick. Sure i will check it out and let you know