WebListBox setting background color per row

I need to color a row in a WebListBox based on a condition. If a device in the list is in an Alarm state I want to color the row so the user can easily spot it and click on it.

How can I color a cell or row?

WebListboxCellRenderer and WebListBoxStyleRenderer should do what you need to

Thanks for the feedback @Hector_Marroquin , I took your advice and started looking into WebListboxCellRenderer (the demo app that ships with IDE). Unfortunately the demo doesn’t work very well, and introduces a whole new level of learning curve. I sure wish there was some simple properties for setting_getting cell styles.

FWIW, here’s the issue I find with the Color Cell.xojo_binary_project (and why it’s unusable). Calling the “New CellBackgroundColor” (sample below) overwrites the “data”, leaving a bunch of blank (red) cells.

I tried calling this line in a different sequence (e.g., call AddRow, then set the cell color, then set the value of the cell again, but this throws some errors.

Here’s the code from the project I mentioned above:

For i As Integer = 1 To 10
  Me.AddRow "data"
  Me.CellValueAt(Me.LastAddedRowIndex, 0) = New CellBackgroundColor(&cFF000077)
Next

Sorry about that. That example file for the WebSDK had some problems. Here’s an updated version.

1 Like