Hi All,
I have been using successfully following code borrowed from the forum, to change the text color in certain cells if the date in date-column is not current date:
It worked fine... until I added B4XTableSelections to get MODE_SINGLE_LINE_PERMANENT behavior
Now when bx4table data is updated, I still get red text color where it is supposed to be, but in the moment I select a row, all text in the whole table changes to black. Same happen if selection mode is to set MODE_SINGLE_CELL_PERMANENT
like this, nothing else is done but clicked the table
In CellClicked-event has only selection handling
What am I doing wrong?
Thanks already!
Br,
-Harri
I have been using successfully following code borrowed from the forum, to change the text color in certain cells if the date in date-column is not current date:
B4X:
Private Sub wtable_DataUpdated
For i = 0 To wtable.VisibleRowIds.Size - 1
Dim RowId As Long = wtable.VisibleRowIds.Get(i)
If RowId > 0 Then
Dim col As B4XTableColumn = wtable.GetColumn("Date")
Dim Value As String = wtable.GetRow(RowId).Get(col.Id)
If is_current_date(Value) = False Then
SetCellFontColor(wtable, i, wtable.GetColumn("Started"), xui.Color_Red)
SetCellFontColor(wtable, i, wtable.GetColumn("Nimi"), xui.Color_Red)
Continue
Else
SetCellFontColor(wtable, i, wtable.GetColumn("Started"), xui.Color_Black)
SetCellFontColor(wtable, i, wtable.GetColumn("Nimi"), xui.Color_Black)
End If'
End If
If i Mod 2 = 0 Then
SetRowColor(wtable,i, wtable.EvenRowColor)
Else
SetRowColor(wtable,i, wtable.OddRowColor)
End If
Next
End Sub
Sub SetCellFontColor (table As B4XTable, RowIndex As Int, Col As B4XTableColumn, Clr As Int)
Dim pnl As B4XView = Col.CellsLayouts.Get(RowIndex + 1) '+1 because of the header
pnl.GetView(0).TextColor = Clr
End Sub
It worked fine... until I added B4XTableSelections to get MODE_SINGLE_LINE_PERMANENT behavior
B4X:
WSelections.Initialize(wtable)
WSelections.Mode = WSelections.MODE_SINGLE_LINE_PERMANENT
Now when bx4table data is updated, I still get red text color where it is supposed to be, but in the moment I select a row, all text in the whole table changes to black. Same happen if selection mode is to set MODE_SINGLE_CELL_PERMANENT
like this, nothing else is done but clicked the table
In CellClicked-event has only selection handling
B4X:
Private Sub wtable_CellClicked (ColumnId As String, RowId As Long)
WSelections.CellClicked(ColumnId, RowId)
End Sub
What am I doing wrong?
Thanks already!
Br,
-Harri