davelt99 Member Licensed User Longtime User Jan 22, 2013 #1 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
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 Jan 23, 2013 #2 Try placing DoEvents just after the ProgressDialogShow Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Jan 23, 2013 #3 You will need to add the DoEvents inside the loop. Though you should not call it every iteration as it will slow down the execution. Upvote 0
You will need to add the DoEvents inside the loop. Though you should not call it every iteration as it will slow down the execution.
davelt99 Member Licensed User Longtime User Jan 23, 2013 #4 Thanks, by including DoEvents in the outer nested loop, that did it. Upvote 0
JonPM Well-Known Member Licensed User Longtime User Jan 23, 2013 #5 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, 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
Erel B4X founder Staff member Licensed User Longtime User Jan 24, 2013 #6 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: Code: Copy 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
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: Code: Copy 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.