Reverse a button click

If a user clicks a button by accident, I want the user to be able to click it again to deselect it. How is that done?

Create an “undo” procedure so that when the user deselects the button anything that has happened … unhappens.

Exactly what I wish I knew how to do!

I’m not a mind reader and neither is anyone else.

So post your blocks showing what happens when a user selects a button.

1 Like

Is it your Pilot Fatigue app or the Button as Checkbox app?

OK! Here is a block. If a user clicks on this button on the screen, x and y happen. I want a subsequent click on the same button to undo it all. Thank you.

pilot fatigue

Use If…else

If >3 legs text colour is red
Set text colour to original colour
Set Fatigue score to original score

Else use your above blocks

Not sure how to make the “if statement” test for text colour.

Use the equals block [=] in the Logic drawer to make it say if >3 legs’s Text Color [=] [color] where [color] is a red or blue block as you have in your screenshots.

Of course! Thanks - I’m a little slow.

I think this is what you are saying.

When I live test this, the first button click does not turn the background color to red. If I take out the “If” statement on the second block, the background does turn red after the first click.

You need an if/else statement but only one event, not two. I can’t post an example from my phone but I can help you later.


Like this:


Thanks so much

This helped me reverse an accidentally clicked button, but can the same thing be done for a list? My app is a survey. Each answer is scored and totaled at the end. Some of the questions are answered by clicking one or more of a series of buttons. Some are a list from which the user can only select one answer. The way I have the lists coded, the user can click on the same list item multiple times, and the variable score increases with each click. The score also increases when the original answer is deselected (ie user clicked it by accident) and a new answer is selected.I only want one answer to count toward my variable score from each list. Here is an example of a block I used for a list:

It’s really hard to help you with such limited information. I know you’ve explained more than before but…

What does the actual survey look like? If I could see it, I could suggest a different way to structure your buttons and lists. But just knowing it’s a survey… it could be set up a hundred different ways. Are there three choices for every answer? Or do some questions have two answers while others have five? There are just so many unknowns that it’s hard to suggest anything specific.

Here are two screen shots from the app.The top screen is an example of where I wanted to use a list, but converted to buttons so I could control my select/de-select problem. The bottom screen is representative of what I’d like to be able to use in some instances. Again, if I click 'red" under “characterize your stress level at work”, it assigns 200 points as seen in the block above. If I click it again, another 200 points is added for a total of 400. If I then click “yellow”, the total goes to 500 - the 400 mentioned, plus another 100 for the yellow click. The “work Stress” box below the list is what changes color as different list items are clicked. The color based on selection works as I want it to.

1 Like