Refresh Progressbar gadget
Posted: Wed Nov 28, 2012 12:50 pm
I have a loop with 94 iterations. Since the total loop takes about 5 seconds (and will be more when data grows) I decided to add a Progressbar indicator. I've set it up with:
As you can see I divided the bar into 94 parts (min value 0, max value 94) and update the bar at the end of the loop with:
I noticed that the refresh of the bar lags and is behind some 5 values from the loop. At the end of the loop when the value reaches 94 the display shows the bar visually at around 88.
I can imagine that something like a progressindicator is not updated very frequently by windows which makes sense. But I don't understand that when it DOES update it doesn't get the current value which is set by SetGadgetState(). It looks like some refresh events are still in the pipeline waiting to be fetched??
I searched the forums for information and tried some of the things suggested there like use Delay(), UpdateWindow_() but that did not help much. So maybe someone can point me in the right direction.
There is one thing that does work however, but obviously that is not the way to go because then the loops lasts several minutes instead of several seconds:
Any help will be much appreciated.
John
Code: Select all
ProgressBarGadget(#PROGRESSBAR,20,4,GadgetWidth(#STATUSBAR_3)-40,14,0,94)
Code: Select all
SetGadgetState(#PROGRESSBAR,GetGadgetState(#PROGRESSBAR)+1)
While WindowEvent() : Wend
I can imagine that something like a progressindicator is not updated very frequently by windows which makes sense. But I don't understand that when it DOES update it doesn't get the current value which is set by SetGadgetState(). It looks like some refresh events are still in the pipeline waiting to be fetched??
I searched the forums for information and tried some of the things suggested there like use Delay(), UpdateWindow_() but that did not help much. So maybe someone can point me in the right direction.
There is one thing that does work however, but obviously that is not the way to go because then the loops lasts several minutes instead of several seconds:
Code: Select all
SetGadgetState(#PROGRESSBAR,GetGadgetState(#PROGRESSBAR)+1)
For i=1 To 100
WaitWindowEvent(500)
Next i
John
