JTmartins Active Member Licensed User Longtime User Apr 7, 2017 #1 I need to process a few folders inside a loop, and cant give the user a feedback of the folder being processed, as all UI is only updated at the end of the loop. The process can take a few minutes, specially because the folders are quite big and are online shared..So apparently there is no easy way to tell the user what is being processed, as I would like to. Any trick to do update the UI while stuff is being done ? Many thanks J Last edited: Apr 7, 2017
I need to process a few folders inside a loop, and cant give the user a feedback of the folder being processed, as all UI is only updated at the end of the loop. The process can take a few minutes, specially because the folders are quite big and are online shared..So apparently there is no easy way to tell the user what is being processed, as I would like to. Any trick to do update the UI while stuff is being done ? Many thanks J
R Roycefer Well-Known Member Licensed User Longtime User Apr 7, 2017 #2 You have a couple options. You can do the heavy lifting in another Thread and occasionally send commands to update the UI to the Main Thread. This will require the Threading library and using Thread.RunOnGuiThread(). Divide the task into blocks and do the heavy lifting in blocks using CallSubDelayed: Code: Sub HeavyLifting(block as int) 'Some heavy stuff '.... UpdateUI If block<MaxBlocks Then CallSubDelayed2(Me, "HeavyLifting", block+1) End Sub Upvote 0
You have a couple options. You can do the heavy lifting in another Thread and occasionally send commands to update the UI to the Main Thread. This will require the Threading library and using Thread.RunOnGuiThread(). Divide the task into blocks and do the heavy lifting in blocks using CallSubDelayed: Code: Sub HeavyLifting(block as int) 'Some heavy stuff '.... UpdateUI If block<MaxBlocks Then CallSubDelayed2(Me, "HeavyLifting", block+1) End Sub
jmon Well-Known Member Licensed User Longtime User Apr 8, 2017 #3 I think Roycefer solution number 2 is the best. Another solution for that is: 3. you could also write a separate jar file and execute it with jShell.RunWithOutputEvents. You can then read the _StdOut and _StdErr events and update the UI according to those raised events. Upvote 0
I think Roycefer solution number 2 is the best. Another solution for that is: 3. you could also write a separate jar file and execute it with jShell.RunWithOutputEvents. You can then read the _StdOut and _StdErr events and update the UI according to those raised events.
Erel B4X founder Staff member Licensed User Longtime User Apr 9, 2017 #4 JTmartins said: Any trick to do update the UI while stuff is being done ? Click to expand... Wait two weeks and there will be a simpler solution with resumable subs. Upvote 0
JTmartins said: Any trick to do update the UI while stuff is being done ? Click to expand... Wait two weeks and there will be a simpler solution with resumable subs.
Cableguy Expert Licensed User Longtime User Apr 9, 2017 #5 lol B4j new beta release eta: end April Upvote 0
BPak Active Member Licensed User Longtime User Apr 9, 2017 #6 Wait For needs Event. Can an event be created to replace say a boolean var? I have been using boolean var global to test in timer for downloading many xml files consecitively! Upvote 0
Wait For needs Event. Can an event be created to replace say a boolean var? I have been using boolean var global to test in timer for downloading many xml files consecitively!
Erel B4X founder Staff member Licensed User Longtime User Apr 10, 2017 #7 BPak said: Can an event be created to replace say a boolean var? Click to expand... Probably yes. Hard to answer without more details. Upvote 0
BPak said: Can an event be created to replace say a boolean var? Click to expand... Probably yes. Hard to answer without more details.
JTmartins Active Member Licensed User Longtime User Apr 10, 2017 #8 I will wait then. I wanted to test threading, but did not find a threading library for B4J Upvote 0