Get and update selected cell in ListView

tsteward

Active Member
Licensed User
Love the listview library its great and much more visually appealing than the Table.

How do I get the contents of a selected cell.

mylv.CELLGET(?,mylv.SelectedRow)

How can I programitacly get the colname of the selected cell?

Thanks
Tony
 

alfcen

Well-Known Member
Licensed User
Hi Steward
Please try this:

Msgbox(lv1.Cellget(lv1.ColName(0),lv1.SelectedRow))
 

tsteward

Active Member
Licensed User
Hi Steward
Please try this:

Msgbox(lv1.Cellget(lv1.ColName(0),lv1.SelectedRow))
Yeah I understand how to use as above which works if a user clicks the first column.

I want to know what the cell contains that the user clicks on assuming its not the first column.

Maybe listview does not allow this and I will have to stick to table!

Ta
Tony
 

Filippo

Expert
Licensed User
Hallo tsteward,

Here is a part of help-file Listview.chm.

B4X:
[B]CellGet[/B]
Get the value of a specific cell in a ListView.
 
Syntax: CellGet (ColName As String, RowNumber As Integer) As String
 
Example:
value = lv.CellGet("Col1", 0)  'Gets the value of the first row in a column named "Col1"
B4X:
[B]CellSet[/B]
Sets the value of a specific cell in a ListView.
 
Syntax:CellSet (ColName As String, RowNumber As Integer, Cell As String)
 
Examples:
lv.CellSet("Col1", 0, "Erel")  'Sets the value of the first row in a column named "Col1" 
 
' Fills the first row with the value "Something" in all cells.
For i = 0 To lv.ColCount-1
     lv.CellSet (lv.ColName(i), 0, "Something")
Next

Ciao,
Filippo
 

tsteward

Active Member
Licensed User
Yeah I realise how to getcell but how do I know exactly what sell a user has tapped/selected.

I need colselected as well as rowselected
 

specci48

Well-Known Member
Licensed User
As I understand the ListView table, you can only select a row but not a column. :(

Tapping on a different column in an already selected row, there is even no selectionChanged event fired. (see help file for "selectionChanged" => Occurs whenever the selected Row is changed.)

specci48
 
Top