Carthalion Member Licensed User Longtime User Nov 7, 2016 #1 This is by Erel from an earlier thread. The answer is about how to send multiple variables from one activity to another. Create a custom type with all this fields and send an instance of this type. Can someone please elaborate on this, or even better, show an example?
This is by Erel from an earlier thread. The answer is about how to send multiple variables from one activity to another. Create a custom type with all this fields and send an instance of this type. Can someone please elaborate on this, or even better, show an example?
Erel B4X founder Staff member Licensed User Longtime User Nov 7, 2016 #2 Code: Copy Sub Process_Globals Type MyPoint (X As Int, Y As Int, Clr As Int) End Sub Sub PrintPoint (p As MyPoint) Log(p.X) End Sub Sub SomeSub Dim p As MyPoint p.X = 100 p.Y = 200 CallSub2 (Me, "PrintPoint", p) End Sub You can also create a helper sub: Code: Copy Sub CreatePoint(X As Int, Y As Int, Clr As Int) As MyPoint Dim p As MyPoint p.Initialize '<-- not required in this case but it is still a good practice. p.X = X ... Return p End Sub CallSub2(Me, "PrintPoint", CreatePoint(100, 200, Colors.Red)) Upvote 0
Code: Copy Sub Process_Globals Type MyPoint (X As Int, Y As Int, Clr As Int) End Sub Sub PrintPoint (p As MyPoint) Log(p.X) End Sub Sub SomeSub Dim p As MyPoint p.X = 100 p.Y = 200 CallSub2 (Me, "PrintPoint", p) End Sub You can also create a helper sub: Code: Copy Sub CreatePoint(X As Int, Y As Int, Clr As Int) As MyPoint Dim p As MyPoint p.Initialize '<-- not required in this case but it is still a good practice. p.X = X ... Return p End Sub CallSub2(Me, "PrintPoint", CreatePoint(100, 200, Colors.Red))