ProgressDialogShow

davelt99

Member
Licensed User
Longtime User
I'm placing ProgressDialogShow with message just before a number of layered Do While loops that perform some extensive calculations taking an average of 10 seconds.

At the end of the loops I'm placing the ProgressDialogHide.

My problem is that the dialog never appears unless I'm in debug mode and stop it at that line.

It doesn't seem to be running asynchronously.

Not sure what I'm doing wrong.

Thank you
 

JonPM

Well-Known Member
Licensed User
Longtime User
Erel, it seems that this issue comes up on occasion. Would it be cumbersome to combine the DoEvents logic with ProgressDialogShow behind the scenes? That way it is called automatically every time
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Calling DoEvents once is not enough as the progress bar will only show as a static dialog. You need to call DoEvents inside your loop. I usually do something like:
B4X:
For i = 0 To 100000 'this is the original loop that is required for the task
  If i Mod 100 = 0 Then DoEvents
 ...
Next
Such logic cannot be added to ProgressDialogShow.
 
Upvote 0
Top