On buttonclick starts and stops process

Hi!

I have popup with a button that either starts or stops a process. Sometimes the button seems to stop and start the process at the same time. The script on the button uses onActionPerformed and it's clicked on using a tablet. I have logging stating that the popup was opened and that the process was started and stopped in the same instance. When the button is pressed, the popup is closed, so you should not be able to get a start and stop at the same instance. So it's really odd that I cant see that the popup has been opened a second time to start the process.

The script readsblocking a tag that states if the process should start or stop. internal_variable = start. Which then is checked in an if statement: if internal_variable == start:
do stuff
else:
do other stuff

Do you know of any way that this set up can be instable and produced both a start and stop from the same click? Should I use another event, such as mouseUp? Should I do a readblocking in the if statement instead of loading it into an internal variable?

onactionperformaned is the generaly the best

From my experience using tactile screen sometimes generate multiples inputs on a button.

My approach would be to use a toggle switch. Then you could execute your start/stop code whenever the button is pressed or release.

You could also use the one-shot button locking it's script for an arbitrarial amount of time.

Depending of your process you could also use another way of executing it. You would need to post a bit more of information to be able to determine that.

Hope this helps you.