I have this declaration :
Later, in a sub, I generate several images, each with different tags
The problem is, when I click the image, always the Tag returns the last value, corresponding to the last image.
Weird thing is that if I dont use the variable FF, but use the integer nF, I get the correct result (0,1,2,3,4 etc).
Please help me with this
B4X:
Type FolderFile (tFolder As String, tFile As String)
Dim Ff As FolderFile
Later, in a sub, I generate several images, each with different tags
B4X:
For nF = 0 To fileList.Size-1
ImageFile = fileList.Get(nF)
Dim Im As ImageView
Im.Initialize("MenuImageEdit")
ff.tfolder = lfolder
ff.tfile = ImageFile
Im.tag = ff
PanelImages.AddView(Im,LeftImg ,ImageY,AnchoPanel,AnchoPanel)
Im.Gravity = Gravity.FILL
Im.Bitmap=f.LoadBitmapSample2(lFolder,limagen,AnchoPanel,AnchoPanel,True)
LeftImg = LeftImg + AnchoPanel + 5dip
IndexPanel = IndexPanel + 1
If IndexPanel = CantPanels Then
IndexPanel = 0
LeftImg = 0
ImageY = ImageY + AnchoPanel + 5dip
End If
Next
The problem is, when I click the image, always the Tag returns the last value, corresponding to the last image.
Weird thing is that if I dont use the variable FF, but use the integer nF, I get the correct result (0,1,2,3,4 etc).
B4X:
Sub MenuImageEdit_Click
Dim listOpt As List, im As ImageView, FF2 as FolderFile
im = Sender
FF2 = im.Tag
listOpt.Initialize
listOpt.AddAll(Array As String("View Image","", ""))
Dim xId As id, wResult As Int
wResult = xId.InputList1(listOpt,"IMAGE")
Select wResult
Case 0
f.ViewImage(FF2.tFolder, FF2.Tfile) ' <------ HERE, ALWAYS THE LAST IMAGE DATA
Case 1
End Select
End Sub
Please help me with this