Update UI while looping. Yes, Again

You can implement that same thing on a Thread class from that era. Subclass the thread, add a timer and when you need the UI to update you start the timer. The timer.Action always fires on the main thread.

Adapted the code from Kem’s sample into more or less exactly this. Thanks both.
Much improved results for the issue which prompted this question.

Currently looking at how I might apply to more complex stuff.

One thing I’d like to share here is that looking into this has really shown up how often I have ‘looked at screen controls’ when doing other bits of code.
I know it’s bad, and I have always told others to keep code and UI separate, but who among us…?

So using a thread to do intensive work needs a few things:

1/ decouple the code from the UI… eg create a threadsafe boolean and refer to that in the thread, instead of 'if checkbox.value then’
2/ if the code works on stored data, you need to ensure that the stored data doesnt change half way through the work. That means even if the display is responsive, maybe some of the controls should not be, and also see point 1… changing a control while a thread is running shouldnt affect the underlying data
3/ the timer needs to know when the thread completes ( mythread.state = threads.notRunning) , so that the display can be re-enabled

yes, a better place for all business logic are classes. (decoupled)
and somehow useful is a enumeration for a app status (instead of boolean flags)