Page 1 of 1

Update Progressbar while other things a running.

Posted: Thu Sep 03, 2020 9:20 am
by captain_skank
Morning all, hope everyone is hale and hearty.

I have a program that, using compateplus, exports SQL query results to a spreadsheet and it all works as it should.

The problem is that it takes a long time to complete, and users are impatient so i'd like to display an animated something and thought a progress bar would do.

So i used a window timer event which is fine until i call my excel procedure and then nothing is updated.

I think i need a thread to update the progressbar ? but am unsure how to go about this because everything i've tried so far has no effect.

Anyone got any pointers on how to acheive this ?

cheers

Re: Update Progressbar while other things a running.

Posted: Thu Sep 03, 2020 9:35 am
by Little John
Hi!

The following works fine for me:
  • The "background job" is done in a thread.
  • Each time a piece of work is finished, the thread uses PostEvent() to tell the main program code about this.
  • When the main program code receives such an event, it updates the progressbar accordingly.

Re: Update Progressbar while other things a running.

Posted: Thu Sep 03, 2020 11:15 am
by captain_skank
Thanks Little John, postevent() did the trick nicely.

I did away with the progress bar and now have a popup window with a animated 'busy' gif.