I'm trying to Get/Set the properties of objects that are hold in a list.
My Objects are declared like (in Class module "Stapel"):
The List is declared like:
Each object is intialized and added successfully.
The only way I could get/set the properties is like that:
Isn't there a more direct way? And why do I need to use the .setmLeft Sub at all, the Guide said I could use .mLeft directly to get or set?
Bear with my, I'm still new to B4A, got my licence an houre ago!
My Objects are declared like (in Class module "Stapel"):
B4X:
Sub Class_Globals
.....
Private mLeft As Int 'Left-Koordinate des Stapels
....
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize( Left As Int)
....
mLeft=Left
.....
End Sub
'I made those "get.." and "set.." as written in the Guide, whowever I can't get the properties as written!
Sub getmLeft As Int
Return mLeft
End Sub
Sub setmLeft(Left As Int)
mLeft=Left
End Sub
B4X:
Sub Process_Globals
Dim mStapel As Stapel
End Sub
Each object is intialized and added successfully.
The only way I could get/set the properties is like that:
B4X:
For i=0 To 9
Dim lStapel As Stapel
lStapel=mStapel.Get(i)'get a local copy of the object
lStapel.setmLeft(1%x+i*(KartenBreite+1%x)) 'set its property
mStapel.Set(i,lStapel) 'put it into the list
Next
Bear with my, I'm still new to B4A, got my licence an houre ago!