I have a Listview that is actionable on a row only with the ItemLongClick. I would like to use the standard click event to highlight the row. I was hoping that SetSelection would do that but all I get is a flash and a click sound.
Do you want the highlight color to stay? This cannot be done with ListView.
You can use CustomListView. However you will also need to modify it to make the selection stay. You can see TableView for an example (TableView is more complicated than CustomListView).
CidTek .. currently using CustomListView and doing exactly that ..
B4X:
Sub ColorRow
'This CustomListview Row / Panel contains 6 Labels
Dim pnl As Panel
pnl = clv1.GetPanel(clickedRow)
'you can just reset the panels backcolor
pnl.Color = Colors.Blue
'OR set the individual labels backcolor and textcolor ..
For i = 1 To 6
Dim lbl As Label
lbl = pnl.GetView(i)
lbl.Color = Colors.RGB(70,130,180) 'SteelBlue
lbl.TextColor = Colors.White
Next
End Sub
Just adding .. you will need to supply some sort of action / event to repaint the row.
@Erel - Yes, I need a row to stay highlighted so an action done from an activebar button will use the info in that LV row. Plus it gives the user visual confirmation before clicking the activebar button.
@mangojack - Is the CustomListView a drop in replacement that will work with core listview methods and properties or will I have to rework my project?
The CustomListView is not a drop in replacement for the ListView,there would be recoding to be done. As far as methods are concerned maybe have a look a this mListView based on native Listview. at a glance it appeared to support highlighting, but I may be wrong.
The CustomListView is not a drop in replacement for the ListView,there would be recoding to be done. As far as methods are concerned maybe have a look a this mListView based on native Listview. at a glance it appeared to support highlighting, but I may be wrong.