B4A Library Grid/Table and ListView Library

David Hawkins

Active Member
Licensed User
Longtime User
Hi

No doubt that the code is correct but how do you set a cell back color, because I am having trouble doing this.

Regards

David
 

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User
With the same code that you wrote:

B4X:
If aCol = 1 Then
  If aRow = 1 Then
  aProps.BackGroundColor = Colors.Green
  End if
End if

Maybe you haven't changed the word "gg" with the name of your xnGrid
 

David Hawkins

Active Member
Licensed User
Longtime User
Hi this is the code I am using 'TimeGrid' is the name of my grid

B4X:
Dim props As xnGridCellProps

        TimeGrid_CellProps(2 , 1, "0", props)

    End If
End Sub

Sub TimeGrid_CellProps (aCol As Int , aRow As Int , aValue As String , aProps As xnGridCellProps )
    If aCol = 2 Then
           If aRow = 1 Then
             aProps.BackGroundColor = Colors.Red
           End If
    End If
End Sub
 

stefanobusetto

Active Member
Licensed User
Longtime User
Try this please.

B4X:
Sub <....>_CellProps ( aCol As Int , aRow As Int , aValue As String , aProps As xnGridCellProps )
If aCol = 1 Then
   aProps.BackGroundColor = Colors.Gray
End If

If aCol = 1 Then
   If aRow = 1 Then
      aProps.BackGroundColor = Colors.Green
   End If
End If
End Sub

The prevoius code sets the background color of the column 1 to Gray
and the background color of the column 1 of the row 2 to green
 

David Hawkins

Active Member
Licensed User
Longtime User
Hi Stefano

I got it to work (sort of) as I did not expect the <...>_CellProps to trigger when I clicked on the grid, is that correct?.

I suppose I was looking for something like nameofgrid.cell(row,col).backcolor = colors.red, does that seem like it is something possible to do?

Regards

David
 

TheMightySwe

Active Member
Licensed User
Longtime User
Hi again,

Is it possible to make a row visible but "disabled", so it does not respond to clicks or longclicks and looks slightly different?
 

stefanobusetto

Active Member
Licensed User
Longtime User
There is no such built in feature.
But if you can create a list of disabled rows indexes and use
the On_CellProps event to custom color the row/cell.
And of course use the same list in the On_Click events
to take no action.
 

stefanobusetto

Active Member
Licensed User
Longtime User
Yes several times.
Should i have some requests i'll do it.
Sorting can be easely achieved using the events
already present in the grid.
 

qsrtech

Active Member
Licensed User
Longtime User
Thank you for the great grid. I can't seem to determine how to "hide" a row. Is this possible? If not can you make it possible?
 

aviario

Active Member
Licensed User
Longtime User
Hello stefanobusetto, when we can have this property for the versión 2.67

PropSetHeight property to change the height of the cells

Thank You
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…