I IamBot Member Licensed User Longtime User Aug 2, 2012 #1 In my program I'm calling a sub routine in order to download a couple of files which can take some time. My program should not proceed until every file has been fully downloaded. Is there an effective way to 'pause' the current activity until the sub routine has reached 'end sub'?
In my program I'm calling a sub routine in order to download a couple of files which can take some time. My program should not proceed until every file has been fully downloaded. Is there an effective way to 'pause' the current activity until the sub routine has reached 'end sub'?
mc73 Well-Known Member Licensed User Longtime User Aug 2, 2012 #2 In such cases, I use a Code: Copy ProgressDialogShow2("yourMessage",False) which I hide at the end of the sub, while at the same time (at the end of the sub) I continue by calling a new sub containing the rest of components I wish to load. You can also experiment with a boolean flag set to true, by looping until the sub is finished. But I don't know if this may cause unwanted behavior (a crash for e.g.). Upvote 0
In such cases, I use a Code: Copy ProgressDialogShow2("yourMessage",False) which I hide at the end of the sub, while at the same time (at the end of the sub) I continue by calling a new sub containing the rest of components I wish to load. You can also experiment with a boolean flag set to true, by looping until the sub is finished. But I don't know if this may cause unwanted behavior (a crash for e.g.).
Erel B4X founder Staff member Licensed User Longtime User Aug 3, 2012 #3 You cannot pause the main thread. Holding it in an endless loop will also not work as the events will not be processed (even if you call DoEvents, as DoEvents only processes UI messages). Upvote 0
You cannot pause the main thread. Holding it in an endless loop will also not work as the events will not be processed (even if you call DoEvents, as DoEvents only processes UI messages).