Android Question [B4X] What library is needed to use B4XTableCellStyle?

vecino

Well-Known Member
Licensed User
Longtime User
Hi, I'm trying to change the colors of a row in a B4XTable, and it tells me that the B4XTableCellStyle library is missing.
Best regards.
 
Hey!

What are your current selected libraries and versions?

Also, do you have a code snippet?

This is all that is needed for B4XTable and changing row colors:
  • B4XTable
  • XUI
  • XUI Views
 
Upvote 0
If you look at the source of b4xtable you can not find a CellStyle there.

Maxbe it is in XUI or XUI Views as it is referenced?
 
Upvote 0
Here is an example of modifying a row's background/text color:

B4X: Copy
    'seed columns
    For i = 0 To 4
        my_table.AddColumn("test" & i, my_table.COLUMN_TYPE_TEXT)
    Next
   
    'seed row data
    Dim rows As List
    rows.Initialize
    For r = 0 To 10
        Dim row(5) As Object  '5 columns: 0..4
        For c = 0 To 4
            row(c) = $"Row ${r} / Col ${c}"$
        Next
        rows.Add(row)
    Next

    my_table.SetData(rows)
    my_table.MaximumRowsPerPage = 20
    my_table.BuildLayoutsCache(my_table.MaximumRowsPerPage)
   
    'loop columns and set 5th row cells backcolor to blue
    Dim targetBlueRowIndex As Int = 4
    For Each d As B4XTableColumn In my_table.VisibleColumns
        If d.CellsLayouts.Size > (targetBlueRowIndex + 1) Then
            Dim pnl As B4XView = d.CellsLayouts.Get(targetBlueRowIndex + 1)
            pnl.Color = xui.Color_Blue
            pnl.GetView(0).TextColor = xui.Color_White
        End If
    Next

1766405284580.png
 
Upvote 0
Hello, it seems that ChatGPT didn't know the answer and made it up :confused:
What I need is to paint the rows that have sums in a different color, like the one I indicate with an arrow.
Thank you.
 
Upvote 0
So it's AI hallucinations.

Check this example:
 
Upvote 0
Back
Top