Dear All,
I´ve only used wait for with websockets, like wait for ws_connected, so this was always refering to an event known by a library.
Then I thought that perhaps I could use Wait for in other situations, such as when one module calls a httpjob download in another module, then downloads something and upon completion calls another sub (or sets a boolean value to true).
So I´d wait for the other sub to be called, and then continue the code.
I´ve made a simplified version of the above, but it does not work. Obviously, I want it to get where it shows the word "Completed" in the log.
What´s wrong?
Also, in situations like these - with jobdone - I find the way I work with it very unstructered, since there´ll be values received in the sub which initiates the job that I want to work with afterwards. As far as I know the only way of handling this is either to give the job a funny name that contains the values, or set the variants that hold the values globally. But is there a more elegant way?
I´ve only used wait for with websockets, like wait for ws_connected, so this was always refering to an event known by a library.
Then I thought that perhaps I could use Wait for in other situations, such as when one module calls a httpjob download in another module, then downloads something and upon completion calls another sub (or sets a boolean value to true).
So I´d wait for the other sub to be called, and then continue the code.
I´ve made a simplified version of the above, but it does not work. Obviously, I want it to get where it shows the word "Completed" in the log.
What´s wrong?
B4X:
#Region Project Attributes
#MainFormWidth: 600
#MainFormHeight: 600
#End Region
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Dim timer As Timer
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
'MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
MainForm.Show
timer.Initialize("timer",1000)
timer.Enabled = True
wait for test
Log ("complete")
End Sub
Sub test
End Sub
Sub timer_tick
test
End Sub
'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub
Also, in situations like these - with jobdone - I find the way I work with it very unstructered, since there´ll be values received in the sub which initiates the job that I want to work with afterwards. As far as I know the only way of handling this is either to give the job a funny name that contains the values, or set the variants that hold the values globally. But is there a more elegant way?
Last edited: