Hi everybody,
i would like to use wait for in the next condition, in Main i have first_sub and in code module i have second and third sub. First sub wait until second is finished and second wait until third is finished. Each sub return a value. If second and third sub are in main it works correct, if i move in code module never turn back to first sub. Can anybody advice me how can i solve? thank you. Attached the test app.
Main:
Code module (m) :
i would like to use wait for in the next condition, in Main i have first_sub and in code module i have second and third sub. First sub wait until second is finished and second wait until third is finished. Each sub return a value. If second and third sub are in main it works correct, if i move in code module never turn back to first sub. Can anybody advice me how can i solve? thank you. Attached the test app.
Main:
B4X:
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
'MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
MainForm.Show
FirstSub
End Sub
Sub FirstSub
Log("FirstSub started")
Sleep(100)
m.SecondSub
Wait For SecondSub_Complete (x As Int)
Log("FirstSub completed:"&x)
End Sub
B4X:
Sub SecondSub
Log("SecondSub started")
'Sleep(2000)
thirdSub
Wait For third_Complete (resp As Int)
resp=resp+1
Log("SecondSub completed"&resp)
CallSubDelayed2(Me, "SecondSub_Complete",resp)
End Sub
Sub thirdSub
Dim resp As Int=1
Log("third started")
'Sleep(2000)
Log("Third completed:"&resp)
CallSubDelayed2(Me, "third_Complete",resp)
End Sub