Change value of ScrollView cell

jpvniekerk

Active Member
Licensed User
Longtime User
Probably a noob question... I have a scrollview and want to change the value of a specific cell only - say row(5) and col(3).
How can do this in the simplest way possible?
 

stevel05

Expert
Licensed User
Longtime User
Ths standard scroll view doesn't have cells, presumably you have based your code on an example from the forum.

If you let us know which one, someone familiar with it will be able to help you much more easily.
 
Upvote 0

jpvniekerk

Active Member
Licensed User
Longtime User
It is based on Klaus' example SQLiteDB

I've looked at the code in this program, but I'm getting confused with all the subs and values returned. I think a very basic statement will also help me understand it a bit better.

Klaus - can you shed some light please
 
Upvote 0

klaus

Expert
Licensed User
Longtime User
In the SQLiteDB example you have following routines:
- GetView, returns the Label with the given row and col indexes.
B4X:
Sub GetView(Row As Int, Col As Int) As Label
' Returns the label in the specific cell
    Dim l As Label
    l = pnlTable.GetView(Row * NumberOfColumns + Col)
    Return l
End Sub
- GetCell, returns the content of the cell with the given row and col indexes.
B4X:
Sub GetCell(Row As Int, Col As Int) As String
' Gets the value of the given cell
    Return GetView(Row, Col).Text
End Sub
- SetCell, sets the value of the cell with the given row and col indexes.
B4X:
Sub SetCell(Row As Int, Col As Int, Value As String)
' Sets the value of the given cell
    GetView(Row, Col).Text = Value
End Sub
Best regards.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…