I am writing an app which puts some of the UI elements in classes to make things easier for me, and to help prevent spagetti code.
So, I have a subroutine in a class like this:
Now I saw the "As ResumableSub" tutorial, but I was wondering if its possible to do a Wait For on a Callback like this? Basically if my Event in Main (callback) has an Async listview dialog or something, I dont want any of that return code running until that GetFile Event is 100% complete.
My immediate thought was this:
But I have not tried it.
thoughts? Do I define GetFile as resumable sub? But its in a different context, hence the callback.
So, I have a subroutine in a class like this:
B4X:
Private Sub cmdChooseFile_Click
If SubExists(Callback, "PlaylistPage_GetFile") = True Then
TempFile.Initialize
Dim M As Map = CallSub(Callback, "PlaylistPage_GetFile") '<--Wait For this 100%
TempFile.ID = DateTime.Now
TempFile.Name = M.Get("FileName")
TempFile.FileName = TempFile.Name
TempFile.FileType = M.Get("FileType")
TempFile.Thumbnail = M.Get("Thumbnail")
txtDuration = M.Get("Duration")
Else
Log("Unimplemented GetFile Handler")
End If
End Sub
Now I saw the "As ResumableSub" tutorial, but I was wondering if its possible to do a Wait For on a Callback like this? Basically if my Event in Main (callback) has an Async listview dialog or something, I dont want any of that return code running until that GetFile Event is 100% complete.
My immediate thought was this:
B4X:
Wait For (CallSub(Callback, "PlaylistPage_GetFile")) Complete (M As Map)
But I have not tried it.
thoughts? Do I define GetFile as resumable sub? But its in a different context, hence the callback.
Last edited: