I made a press of a button to receive a value and move on to the next problem.
But there is a problem.
I press the button several times before moving on to the next problem, and the same value comes up several times.
I only need to get the value once. What should I do
If possible, please explain in block.
I asked a question but I didn’t know what I mean because there is no block example.
Why do you press the button several times in the first place?
From the way you describe it, it seems you press it several times because you think that it did not “understand” it the first time (something I call the “elevator urgency syndrome”: pressing an elevator button several times will NOT make the elevator move any faster).
So what you need is to disable the button at the first press; you can also make it change colour in an obvious manner while disabled or change the caption, or have the program pop-up a notification window with “computing…” message to signal that processing the data is not an instantaneous matter and that pressing several times will not make anything go any faster.
The video is a quiz question.
I quickly clicked the wrong answer among the four answers.
Then I got 5 wrong answers and the quiz was over.
I want to solve these problems.
What I’ve implemented is that if you pick the correct answer, it tells you whether it’s wrong or not, and the next question is automatically asked.
You may want to read about programming “states.” The idea of a state is that your app exists in a certain status (e.g. “waiting for user response”) and then moves on to another status (e.g. “checking answer”). During each state, only certain inputs are allowed.
For example, if you are in the “checking answer” state, the answer buttons would be disabled. And by clicking on a button in the “waiting for user response” state, that changes the state to “checking answer” so that the user cannot possibly tap an answer button more than once.
Then, when you generate a new question in the “new question” state, you re-enable the answer buttons and change to the “waiting for user response” state.
What this means is that you need to have an inhibitor logic. When one button is clicked, it sets a value such that additional presses are ignored, and that responsiveness is restored only after the program has displayed “sorry wrong answer” and moved to the next question.
It is entirely under your control.