Problem with dealing with UI update on progress window

Hi Folks,

I have a progress window, that I create and show when I have a long running process in my apps.
I’ve tried to use threads and timers, and avoid doevents like mentionned on this forum…
my progress window is never shown unless I call doevents when I send new progress bar value from the main long running method
the UserInterfaceUpdate of the thread is called the right number of times, I update the value of the progressbar there, but the progress window (and the bar) doesn’t get updated
what can it come from ?
the window is a movable modal type.


Are you calling the thread’s sleep method to give other things a chance to run? Even 1ms will do.

doesn’t change anything.
the windows is updated at start, but nothing happens until the method finishes and the window is closed …

Capture d’écran 2023-03-09 à 12.11.08 - Moyenne

I tried to put a label at the bottom left of the window, with the value of the progress, and nothing is displayed !
although if I break with the debugger, the label.text gets updated in code…
seems the window is frozen ?

may be some hint: it kind of worked with 2019r11, but it does not works anymore with 2022r41…

There is an example in the Xojo examples which shows you how to update the progress. And yes, it’s a bit of a bother to do.

well after some(!) searches, it seems the progress bar does not get refreshed…
if I display the progress bar value as a text label , it is shown and updated correctly…
and the progress bar is not updated accordingly…
if I change the progressbar to a desktopprogressbar, and call Refresh(true) it is still not updated as it should…

small gif of the updating process …
the number bottom left ( correctly updated) is the value that is stored in the progress bar… which doesn’t move at all…
at 10 sec, a timer showing the remaining time appears correctly at the bottom right.

Enregistrement de l’écran 2023-03-09 à 12_59_10.2023-03-09 13_00_15

1 Like

10 years ago, I followed this path for an Import Text to SQLite with lots of test / Replace(s)…

Then, I created my own Progress window with a nice green feeded rectangle.

So many work for a single use (it was the archive / actual data). But I was finalizing the project and do not realize this will never be seen by any user, only by me.

:innocent: or :japanese_ogre: depending on the point of view.

Make an example. You are doing something wrong.

What Xojo version? And OS. I vaguely recall something related to the progress component for some release. Maybe not your case, but…


Ah, I’ve found it, not your case. I think it was an user mistake.

Try to make a sample and share with us.

well, it took already too much time for such a simple thing.
I replaced the progressbar with a canvas and now it works …

Did you try calling refresh on the progress bar after changing its value?

Did you use a large maximumvalue or just 100 ?

Also, make sure DesktopProgressBar.Indeterminate = False

And fire UserInterfaceUpdate events from your thread using AddUserInterfaceUpdate(name : value)

if windows ignore a permanet refresh because it is to often you can compare the time from last to current progress and update the ui as example each second.
what i used in vb6 if there is a for next i update only if (i mod 1000)=0 ← or something like that.

yes - no change. even with immediate refresh

I did not try that

what I did not understand is that all other items on the windows are refreshing ok, and only the progressbar doesnt

I used 200 as a maximum value. 100 was not smooth enough for very long methods.