[CODE=b4x]Public Sub MySub ' In Another Component
Sleep(1000)
CallSub3(Sender, "MySub_Complete", True, Null)
End Sub
Public Sub MySub2 ' In Current Component
Dim SenderObject As Object = MySub
Wait For (SenderObject) MySub_Complete (Success As Boolean, Result As Object)
Log(Success)
End Sub
Public Sub MySub2
'Avoid MySub
'Avoid Wait For MySub_Complete(Success As Boolean, Result As Object)
Wait For (MySub) Complete (Success As Boolean, Result As Object)
End Sub[/CODE]
I want to avoid using callsub, but i dont know how to return more than one parameters as the example above!
Or something like this:
B4X:
Dim SenderFilter As Object = SQL_.ExecQueryAsync("SQL", QueryString, Args)
Wait For (SenderFilter) SQL_QueryComplete (Success As Boolean, Rs As ResultSet)
How SQL_.ExecQueryAsync Returns the two values without using component value that callsub needs?
This doesnt work even not fails:
B4X:
Public Sub MySubInAnotherComponent
Sleep(1000)
CallSub3(Sender, "MySubInAnotherComponent_Complete", True, Null)
End Sub
Public Sub MyCurrentSub
Dim SenderObject As Object = MySubInAnotherComponent
Wait For (SenderObject) MySubInAnotherComponent_Complete (Success As Boolean, Result As Object)
Log(Success)
End Sub
Sorry - but I have no idea what you mean by that. I meant
B4X:
Public Sub ExecQueryAsync2(QueryString As String, Args As List) As ResumableSub
Dim SenderFilter As Object = SQL_.ExecQueryAsync("SQL", QueryString, Args)
Wait For (SenderFilter) SQL_QueryComplete (Success As Boolean, Rs As ResultSet)
Dim Response As ResponseBuilder
Response.Initialize
Response.Success = Success
Response.Data = Data.As(Object)
Return Response
End Sub
I'm not familiar with ResponseBuilder but as you cast it to Object in Sub Create I've cast it to Object in the assignment to Response.Data. That might not be needed depending upon the type expected.
Data variable does not exist in this example. Even if you mean Rs.As(Object) this is done automatically because Response.Data Property Is Type Object. It can be used for many reasons except from a RecordSet