The Sender object repeatedly affects the last of these labels created by code. I try to change the color to the pressed label, but change the color in both.
I have also tried through the use of an array in Activity Create (lbNames (5)), but the result is the same.
It detects other properties individually and changes them without inconvenience. The same does not happen with color.
B4X:
For c = 1 To 4
lbCl.Initialize("lbName")
lbCl.TextSize=14
lbCl.Background=cdWhite
lbCl.TextColor=Colors.White
Inf=Prs.Get(c-1)
lbCl.Text=Inf
lbCl.Tag=Inf
lbCl.Gravity=Gravity.CENTER
Activity.AddView(lbCl,gLeft,gTop,LB.CWidth,LB.CHeight)
gLeft=gLeft+LB.CWidth
Next
Public Sub lbName_Click
Dim LBL As Label
LBL=Sender
LBL.Color=Colors.Red
End Sub
I have also tried through the use of an array in Activity Create (lbNames (5)), but the result is the same.
It detects other properties individually and changes them without inconvenience. The same does not happen with color.
Last edited: