J Jerryk Active Member Licensed User Longtime User Jul 28, 2024 #1 I have a theoretical question. I use B4XPages. I can call sub between the pages directly. Is there any difference between this and calling CallSubDelayed? Page3.ClearImage or CallSubDelayed(Page3, "ClearImage")
I have a theoretical question. I use B4XPages. I can call sub between the pages directly. Is there any difference between this and calling CallSubDelayed? Page3.ClearImage or CallSubDelayed(Page3, "ClearImage")
LucaMs Expert Licensed User Longtime User Jul 28, 2024 #2 In that case, the only difference is that if there were any other lines after CallSubDelayed, they would be executed before the called Sub. Upvote 1
In that case, the only difference is that if there were any other lines after CallSubDelayed, they would be executed before the called Sub.
agraham Expert Licensed User Longtime User Jul 29, 2024 #3 Calling the Sub directly executes the called Sub immediately before returning to complete the rest of code in the calling Sub. CallSubDelayed posts the call to the apps message loop and so the Sub will only be called when the calling Sub, and any others in the call chain, all complete and execution returns to the message loop which will then call the delayed Sub. Upvote 0
Calling the Sub directly executes the called Sub immediately before returning to complete the rest of code in the calling Sub. CallSubDelayed posts the call to the apps message loop and so the Sub will only be called when the calling Sub, and any others in the call chain, all complete and execution returns to the message loop which will then call the delayed Sub.
LucaMs Expert Licensed User Longtime User Jul 29, 2024 #4 There is another big difference: you can call a function (Sub) directly, that is, get a return value, but you cannot do that with CallSubDelayed (or, better, you can execute the call but not receive the result). Upvote 0
There is another big difference: you can call a function (Sub) directly, that is, get a return value, but you cannot do that with CallSubDelayed (or, better, you can execute the call but not receive the result).