I use this two subs to load items into CLV, every thing is OK, but when I click the row, sometimes toggles row selection, and sometimes it changes selection mode to multiple rows as shown in attached picture. I tried this example but also behaves the same. did I miss something?
CLV selections code:
B4X:
Sub ListNewItems()
lstvNewWhat.Clear
Dim rd As CLVrowData
rd.Initialize
Dim Ln As Int = 90dip
rd.Description = "Create new or edit existing trip order."
rd.RowTitle = SysDeclare.NEW_INDEX_TRIP_ORDER
rd.Icon = LoadBitmapResize(File.DirAssets,"order-icon.png",24dip,24dip,True)
lstvNewWhat.add(CreateListItem(rd,False, lstvBrowseWhat.AsView.Width, Ln), SysDeclare.NEW_INDEX_TRIP_ORDER)
rd.Description = "Add or update system list items."
rd.RowTitle = SysDeclare.NEW_INDEX_LIST
rd.Icon = LoadBitmapResize(File.DirAssets,"list-icon.png",24dip,24dip,True)
lstvNewWhat.add(CreateListItem(rd,False, lstvBrowseWhat.AsView.Width, Ln), SysDeclare.NEW_INDEX_LIST)
rd.Description = "Create new or update existing shared contact."
rd.RowTitle = SysDeclare.NEW_INDEX_CONTACTS
rd.Icon = LoadBitmapResize(File.DirAssets,"contacts-icon.png",24dip,24dip,True)
lstvNewWhat.add(CreateListItem(rd,False, lstvBrowseWhat.AsView.Width, Ln), SysDeclare.NEW_INDEX_CONTACTS)
rd.Description = "Update vehicles In\Out log."
rd.RowTitle = SysDeclare.NEW_INDEX_VEHICLES_LOGGER
rd.Icon = LoadBitmapResize(File.DirAssets,"log-icon.png",24dip,24dip,True)
lstvNewWhat.add(CreateListItem(rd,False, lstvBrowseWhat.AsView.Width, Ln), SysDeclare.NEW_INDEX_VEHICLES_LOGGER)
End Sub
Sub CreateListItem(RowData As CLVrowData,HideButton As Boolean, Width As Int, Height As Int) As Panel
Dim p As Panel
p.Initialize("")
Activity.AddView(p, 0, 0, Width, Height)
p.LoadLayout("CLVrow")
p.RemoveView
'imgRowIcon.Bitmap = RowData.Icon
If Not (HideButton) Then imgRowIcon.Bitmap = RowData.Icon
btnSelectRow.Visible = Not(HideButton)
imgRowIcon.Visible = Not(HideButton)
lblRowTitle.Text = RowData.RowTitle
lblDescription.Text = RowData.Description
Return p
End Sub
CLV selections code:
B4X:
Private CSelectionsNew As CLVSelections
Private CSelectionsBrowse As CLVSelections
Private XUI As XUI
B4X:
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("home")
tabHome.LoadLayout("newwhat", Chr(0xF115) & " New" )
tabHome.LoadLayout("browsewhat", Chr(0xF1E5) & " View" )
lstvBrowseWhat.DefaultTextBackgroundColor = XUI.Color_White
lstvNewWhat.DefaultTextBackgroundColor = XUI.Color_White
CSelectionsBrowse.Initialize(lstvBrowseWhat)
CSelectionsNew.Initialize(lstvNewWhat)
CSelectionsBrowse.Mode = CSelectionsBrowse.MODE_SINGLE_ITEM_TEMP
CSelectionsNew.Mode = CSelectionsNew.MODE_SINGLE_ITEM_TEMP
ListIBrowsetems
ListNewItems
B4X:
Sub lstvNewWhat_ItemClick (Position As Int, Value As Object)
Dim strVal As String = Value
Dim CallActivity As Object
CSelectionsNew.ItemClicked(Position)
CSelectionsNew.Clear
.
.
....