Events rules in a simple Loop

I understand this loop doesn't work as I could expect in another languages, but i think should be a simple way to solve instead to use a clock or temporizer. Maybe if could be any way to run an event from a block, or force to actualize the GUI or something similar?

PruebaLoop

The clock is a simple solution. Loops work, but for math and similar operations. However, we don't use the GUI in loops. We use a clock for this.

I appreciate the answer, but I was thinking in a solution like ‘Call Button.Click’ from the program, or better yet 'Call Button.”Run”’ or similar new option to allow run an event or pseudoevent from the program. This wouldn't break any event rule, but it would make programming substantially easier and more intuitive.

you might want to read more about The model of event processing in App Inventor by Lyn to understand, why a clock component should be used in your case

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

Do it this way. It will work as you want and you won't notice the difference.

blocks - 2021-02-16T205504.238


Thank you, I appreciate the answers. I understand the proposed is the better way nowadays to solve this kind of situations. Maybe in the future the MIT App Inventor team could include some new feature that allow, as I said before, a solution like ‘Call Button.Click’ from the program, or better yet 'Call Button.”Run”’ or similar new option to allow run an event or pseudoevent from the program. This wouldn't break any event rule, but it would make programming substantially easier and more intuitive, allowing to obtain a simple and clear program similar to this:

PseudoEvent

The long term solution that needs to be implemented is a technique called continuation passing style. However, getting this right is very tricky and we don't want to accidentally introduce bugs into people's code that they can't fix because the change results in different code output than App Inventor currently produces. Continuation passing would allow different events to interleave by not blocking the UI thread while execution occurs. The lack of continuation passing right now is the main reason why the use of the Clock is necessary for loops that run over time and the reason why we don't have a wait block unlike other blocks based languages (e.g., Scratch).

Thank you for your complete and clear answer. I understand there is not a simple and quick solution. I hope could be done in the future.