A anaylor01 Well-Known Member Licensed User Longtime User Nov 11, 2012 #1 I want to run a loop until a button is clicked? How do I do that?
M MLDev Active Member Licensed User Longtime User Nov 11, 2012 #2 With DoEvents. B4X: Do Until tglSwitch.checked ' do something DoEvents Loop Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Nov 11, 2012 #3 It is not recommended to create such loops. Not all events will fire and the app will not be responsive. You should instead complete the current code execution and continue in Button_Click event. Upvote 0
It is not recommended to create such loops. Not all events will fire and the app will not be responsive. You should instead complete the current code execution and continue in Button_Click event.
M MLDev Active Member Licensed User Longtime User Nov 11, 2012 #4 Hi Erel, Erel said: It is not recommended to create such loops. Not all events will fire and the app will not be responsive. You should instead complete the current code execution and continue in Button_Click event. Click to expand... I'm working on an app that simulates an old computer. I'm using this code to run machine code on the simulation: B4X: Sub runProg Do While tglSwitchRun.checked AND breakPoint = False DoEvents S0_fetch S1_execute Loop ... End Sub It seems to work fine. How should I do this? Upvote 0
Hi Erel, Erel said: It is not recommended to create such loops. Not all events will fire and the app will not be responsive. You should instead complete the current code execution and continue in Button_Click event. Click to expand... I'm working on an app that simulates an old computer. I'm using this code to run machine code on the simulation: B4X: Sub runProg Do While tglSwitchRun.checked AND breakPoint = False DoEvents S0_fetch S1_execute Loop ... End Sub It seems to work fine. How should I do this?
Erel B4X founder Staff member Licensed User Longtime User Nov 12, 2012 #5 I'm not sure what these two method do. However it should be simple to use a timer instead of this loop. Upvote 0
I'm not sure what these two method do. However it should be simple to use a timer instead of this loop.