TVrThread and TAdvSmoothProgressBar

I'm doing some serious database updates that take several minutes to complete. I don't want the users to get impatient and kill the app. I'd like to use the marquee option of the TAdvSmoothProgressBar, but of course it hangs during the running of the query. I'm looking for an easy way to do threads and found VrThread. I tried using the OnExecute method, but don't see now to move the marque.

Is this doable?



The marquee update always needs to be done from the main app. ui thread. The solution is to launch the DB query in a separate thread so the main app UI thread is not blocked.

I moved the query to the thread where it runs in the OnExecute method. That works fine. The marquee runs just fine (if the query is not running). The problem is that even with this setup, once the query starts, the marquee stops. 2 or 3 minutes later, when the query ends, the marquee starts up again.

I start with the thread Enabled=false, then set it to true when I'm ready to start the query. The first thing the thread does is set it's Enabled back to false.

The TAdvSmoothProgressBar I have set to Style=pbstMarquee. I also have a TAdvSmothWin8Marquee on the form and it behaves the same way.

Is there something else I need to do to get the marquees moving?


It's unclear why there would still be something blocking the UI thread. Does it have effect to lower the thread priority?

I have tried setting it to tpLower, tpLowest, tpIdle, and it does the same thing on each setting.

Without knowing more details about your implementation, I have unfortunately not directly an idea what more to look at.

Maybe I do not understand what threading is supposed to do. Here's my test:

1. I put both a TAdvSmoothProgressBar (Style=pbstMarquee) and a TAdvSmothWin8Marquee on the form.

2. On that same form I have a TVrThread.

3. In the tread's OnExecute I now have only this:

   while true do


4. In the form's OnActivate I set the thread.Enabled := true

When I run the program, the infinite loop runs, but the marquees do not move.

Shouldn't they be moving? What am I missing?

Do you have an example that uses TVrThread?

Please set VrThread.SyncEvent = false

Thank you, that worked. In order to get the app to close properly I also had to call "VrThread1.Enabled := false;" in OnExecute.

In case anyone else is interested, here's my test that works:

procedure TForm1.VrThread1Execute(Sender: TObject);


   Caption := IntToStr(iCount);



   if iCount >= 3 then


      Caption:= 'Complete';

      VrThread1.Enabled := false;