Hello,
Someone could let me know what is my mistake when I want to fill a list with object
Here is a simple Class
Sub Class_Globals
Dim Nom As String
Dim BorderColor As Int
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize(bt As Map)
Nom = bt.Get("Name")
Text = bt.Get("Text")
End Sub
Here is the main
Sub Process_Globals
Public Bouton As List
End Sub
Sub Activity_Create(FirstTime As Boolean)
Dim tmp_Bt As OE_Bouton
Activity.LoadLayout("Lay_Main")
Bouton.Initialize
JSON.Initialize(File.ReadString(File.DirAssets, "example.json"))
Dim root As List = JSON.NextArray
For Each colroot As Map In root
tmp_Bt.Initialize(colroot)
Bouton.add(tmp_Bt)
Next
End Sub
I deserialize a 'json' and would like to transfer all the items in the 'Bouton' variable.
Everythings good unless when I check the value transfered to "Bouton" : all its items are equal to the last one.
How must I define the temporary variable 'tmp_BT' to fill the 'Bouton.items' with its value and not with its address ??
Thanks for your help.
Olivier