So, big loop.
Lots to do.
How the heck do you get the screen to update and show a progress?
Either Windows starts complaining that the app is not responding and wants to kill it, or we try to use DoEvents which is a Bad Thing (and rarely solves the issue)
I have a nice graphic to show the progress - works fine on Mac, but doesnt update in Windows and after 18 years of using Xojo Im sick of this situation.
Surely there must be a way to do this ?
Games update the screen a lot more times per second than I need to.
a method call block the ui until your method exists.
therefore the unhandily thread class was created.
without this thread
instead of using for i = 1 to 1000
process this list in parts and let the app breathe.
as example a timer could fetch next small task from a list and process it.
in games the ui and game/physic “loop” are usually separate.
More like a change in functionality so I was just working out where you are before I offer some help, trying to figure out the best way to get you where you want to be as there may be a workaround without getting into a rewrite.
How are you telling your progress bar to update?
Is it on a canvas/control so Invalidate or Refresh?
Or are you using a progress bar control?
in case of your loops
a single call would be “one interesting calc x,y”
after it is processed do the next from a prepared list.
you could also process for a second a bunch and then let the app response
a timer could trigger the next process.
Thread or Worker could be useful for you too.
using invalidate to much could result in nothing because windows ignore it.
and the method where you call it must end that the ui update comes.
Another option is my Looper control. Drag it to the window and implement the events like HandleIteration, MoveNext, and Paused. It emulates what a Thread will do for you, but on the Main Thread and with finer control for updates.
Thanks for the ideas. Something to play with.
Sadly, I haven’t been able to actually use any Windows Xojo version after 2015 , so that Thread.adduserInterfaceupdate isnt available to me in this particular project.
New ones, yes.
But maybe the modal window that uses a timer to look at common properties which are affected by a thread…
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. I queue a dictionary and pass whatever I have accumulated in the action event (again which fires on the main thread) and let the UI update then. There are various implementations of this floating around and if you need I can dig out my old BKSThread class that did this.