I have a longer lasting calculation in my Windows app. How can I avoid the message ‘not responding’?
I placed this process in a Timer(single run) but when I click on a ListBox on the main window the Window Title shows additional ‘not responding’.
Then the windows is blocked while the process is running. After this process all is OK.
You should perform any long running code in a Thread. This will keep your UI responsive. Have a look at Example Projects > Desktop > ThreadingExample.
The code that is run in the thread should not refer to or update any visual component.
You shouldnot rely on the outcome until the timer state becomes ‘not running’
That is usually checked in a timer that runs and checks the thread state every so often.
The Timer can update the screen if you wish.
Thanks Anthony and Jeff, my 1st try was this way but this thread has no access to the UI. Now I try it via a timer to actualize the UI.
Threads in 2019r2+ have events to update the UI
Yes, when that was introduced, I was able to take out a lot of timers
Take a thread is my solution. Thanks all.
I’m not a Pro, so it was not easy to get an understandable example running.
The Xojo help/documentation and the with Xojo installed Desktop Thread was not helpful for me.
The best help was the Blog about the Xojo programming language and IDE with Doing Progress Right.
The link is: https://blog.xojo.com/2020/02/27/doing-progress-right/.
With this Blog entry it was for me possible to create a small running and understandable program.