I have a vision button that displays an ignition in-built confirmation popup. When the user clicks OK in the popup, the script writes to a tag and updates the button text.
However, if the button is clicked again immediately after clicking OK (before the tag write completes), the popup appears again.
How can I prevent the popup from appearing until the tag write has fully completed?
You could disable the button first thing in the script. Then enable it after the tag write attempt. You might want to check the tag write return value for success and add a try/except so you don’t end up in an undefined state depending on what you script looks like.
What do you mean multiple components? You could use a single root-level property (or vision client tag) to enable/disable the components until the write is complete and then bind that to all components that you need temporarily disabled and then re-enable with a gateway event script.
Even that doesn’t sound like a great idea, so I guess the question we should be asking is - is there a better way to handle this than what is currently being used?
Is there a problem that is caused by writing the tag twice?
Would checking the value of the tag or another prop during the script and before writing it help? Update the prop first in the script before writing. That way, even if the confirm popup appears again it doesn’t actually do anything if the tag has already been written.