Mutl-istate Button, Multi-Confirm Text

I would like to be able to change the Confirm Text based on the state that is to be changed to. How do I capture the selected state to conditionally set the Confirm Text property?

1 Like

I do not think this will work given the order you are desiring. You can give different responses based on the currently selected value, that would just require a binding that utilizes a case() expression and the Control Value property.

The confirm text popup will appear only after you have completed a click on the component. This action does not change the selected value, it instead prompts the popup to open. In that moment there is no information available about the value that is to be changed to, so you cannot change the text based on that.

You could possibly turn off the default confirmation and script your okay confirmation popup.

While have not tested or verified here is link to some custom jython boxes which i “think” will work in ignition

I agree with andrews idea.

An Ignition function that may satisfy your use-case would be system.gui.confirm(). It creates a confirmation popup similar to the built-in component based one.

When the component is clicked, the Control Value property changes, so a propertyChange script can utilize the confirm() function to ask if the user to confirm the state that is to be changed to. The write action to the tag would be based on if the confirm() popup returns true when the user clicks yes.

1 Like

Best test that last… ):

@pturmel care to share some bits of wisdom? (sad face was not very comforting lol)

Buttons that offer a built-in confirmation operation for a bidirectionally bound control value will change the control value after the confirmation. There is no way to defer the change to the control value with a hand-coded confirmation.

Just say no.

Use two buttons–one to set a “write-enabled” state, the other to perform the write (and optionally reset the state). This approach has the side benefit of not using any UI-freezing modal popups.

1 Like