Having used CustomListView in both B4A and B4i I thought I knew how to do this......
A CLV cell has an Image and a Label loaded from a layout... so far so good. Unfortunately I am unable to access any view property from a clicked cell. Something appears to be different in B4J which I am totally missing. What code is required in the CLV click event to explore the views contained within in it?
A CLV cell has an Image and a Label loaded from a layout... so far so good. Unfortunately I am unable to access any view property from a clicked cell. Something appears to be different in B4J which I am totally missing. What code is required in the CLV click event to explore the views contained within in it?
B4X:
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private xui As XUI
Private imgThumbnail As B4XView
Private lblCountry As B4XView
Private clvCountries As CustomListView
Private SQL As SQL
End Sub
Sub AppStart (Form1 As Form, Args() As String)
SQL.InitializeSQLite(GetEnvironmentVariable("DataDir",""),"Flags.db3",False)
MainForm = Form1
MainForm.RootPane.LoadLayout("main")
MainForm.Title = "World Flags"
MainForm.Show
Dim rs As ResultSet = SQL.ExecQuery("SELECT * FROM ISO2 ORDER BY Country")
Dim DefaultHeight As Int = 65dip
Do While rs.NextRow
Dim Buffer() As Byte
Buffer = rs.GetBlob("Thumbnail")
Dim InputStream1 As InputStream
InputStream1.InitializeFromBytesArray(Buffer, 0, Buffer.Length)
Dim bmp As Image
bmp.Initialize2(InputStream1)
Dim p As B4XView = xui.CreatePanel("")
p.Tag = rs.GetString("ISO2code")
p.SetLayoutAnimated(0, 0, 0,clvCountries.AsView.Width, DefaultHeight)
p.LoadLayout("clvItem")
ImgThumbnail.SetBitmap(bmp)
lblCountry.Text = rs.GetString("Country")
clvCountries.Add(p,"")
Loop
End Sub
Sub clvCountries_ItemClick (Index As Int, Value As Object)
Log("This event fires every time as expected")
'What code is required here to expose the cell tag property and lblCountry.Text?
End Sub