Hello,
I need to change the color of the content of one column, according to the content of another.
In the example I test, they change the color, if the content has a positive or negative value. In my case, I want the color to change, but if another column contains an "S" or "".
This code is the current example and it works:
But I need to change the color according to the content of another column, something like this:
Col_ENE_si = B4XTable1.AddColumn("ENE_si" , B4XTable1.COLUMN_TYPE_TEXT)
...
Private Sub ENE_Si (c As B4XTableColumn)
Dim formatter As B4XFormatter
formatter.Initialize
c.Formatter = formatter
Dim Positive As B4XFormatData = c.Formatter.NewFormatData
Positive.FormatFont = xui.CreateDefaultBoldFont(16)C
If Col_ENE_si = "S" Then --->>>> HOW DO I OBTAIN THE CONTENT OF THE COLUMN "Col_ENE_si" ???
Positive.TextColor = B4XTable1.TextColor
Else
Positive.TextColor = xui.Color_Gray
End If
c.Formatter.AddFormatData(Positive, 0, c.Formatter.MAX_VALUE, True) 'Inclusive (zero included)
End Sub
Here he tells me that the TYPES do not MATCH and of course it does not work ...
Regards,
Sergio
I need to change the color of the content of one column, according to the content of another.
In the example I test, they change the color, if the content has a positive or negative value. In my case, I want the color to change, but if another column contains an "S" or "".
This code is the current example and it works:
B4X:
Private Sub CreateCustomFormat (c As B4XTableColumn)
Dim formatter As B4XFormatter
formatter.Initialize
c.Formatter = formatter
Dim Positive As B4XFormatData = c.Formatter.NewFormatData
Positive.TextColor = B4XTable1.TextColor
Positive.FormatFont = xui.CreateDefaultBoldFont(16)
c.Formatter.AddFormatData(Positive, 0, c.Formatter.MAX_VALUE, True) 'Inclusive (zero included)
Dim Negative As B4XFormatData = c.Formatter.CopyFormatData(Positive)
Negative.TextColor = xui.Color_Red
Negative.FormatFont = xui.CreateDefaultBoldFont(14)
Negative.Prefix = "("
Negative.Postfix = ")"
c.Formatter.AddFormatData(Negative,c.Formatter.MIN_VALUE, 0, False)
End Sub
But I need to change the color according to the content of another column, something like this:
Col_ENE_si = B4XTable1.AddColumn("ENE_si" , B4XTable1.COLUMN_TYPE_TEXT)
...
Private Sub ENE_Si (c As B4XTableColumn)
Dim formatter As B4XFormatter
formatter.Initialize
c.Formatter = formatter
Dim Positive As B4XFormatData = c.Formatter.NewFormatData
Positive.FormatFont = xui.CreateDefaultBoldFont(16)C
If Col_ENE_si = "S" Then --->>>> HOW DO I OBTAIN THE CONTENT OF THE COLUMN "Col_ENE_si" ???
Positive.TextColor = B4XTable1.TextColor
Else
Positive.TextColor = xui.Color_Gray
End If
c.Formatter.AddFormatData(Positive, 0, c.Formatter.MAX_VALUE, True) 'Inclusive (zero included)
End Sub
Here he tells me that the TYPES do not MATCH and of course it does not work ...
Regards,
Sergio