B4A Library [Class] Wait - instead of ProgressDialogShow

ProgressDialog looks very small on my Tablet and I usually do not use it in loops because the DoEvents in the loop slows the execution.
While working on the Treeview class I had an idea to show the progress but call the Doevents not every loop but after a group of cycles. This did speed up the execution and still the progress dialog was showing.

I put this trick together with an animated Gif to get this new Wait Class.
What you can't see in the picture is that the clock wanders around the panel, so you need to download it.

Edit: modified to 1.1 using mod in the loop.
Edit: forgot to mention, it needs GifDecoder by Agraham http://www.b4x.com/forum/additional...79-animated-gif-decode-library.html#post39784
Edit: updated to version 1.2 to correct a problem which appears only in debug - the gifdecoder cannot find the file in DirAssets.
Edit: Ver 2.0 includes a new method - show1, using a timer to do the job of the Doevent in a loop, for the cases that you have to wait for some event and there is no loop... (sorry for the short life of version 1.2)
 

Attachments

  • wait.png
    wait.png
    26.5 KB · Views: 2,863
  • wait2.0.zip
    261.5 KB · Views: 457
Last edited:

peacemaker

Expert
Licensed User
Longtime User
Thanks.
Usually was ok to add to the loop something like:
If (i mod 100) = 0 then DoEvents
 

derez

Expert
Licensed User
Longtime User
call the Doevents not every loop but after a group of cycles
The size of the group depends on the time that it takes the loop to cycle around, so it is up to the programmer to set it.
Anyway, the use of mod is better then what I did.
 
Top