Change listviewitem text color in delphi

I am trying to change the color of text in my listviewitem for a text object. I have several text objects in a listviewitem. I am using the code below

Litem := ListView1.Items.Add; Litem.Data['ytde'] := currtostrf(ytde,ffCurrency,2); Litem.Data['ytdbe'] := currtostrf(ytdbe,ffCurrency,2); Litem.Data['ytdetotal'] := currtostrf(ytdetotal,ffCurrency,2); Litem.Objects.TextObject.TextColor := TAlphaColorRec.Green 

An error during debugging indicates an inaccessible object, but I have no problems with color changes when I do below

 LItemheader.Purpose := TListItemPurpose.Header; Litemheader.Objects.TextObject.TextColor := TAlphaColorRec.blue; 

any ideas?

+5
source share
1 answer

Found answer:

 TListItemText(Litem.Objects.FindDrawable('ytde')).TextColor := TAlphaColorRec.Red; 
+4
source

Source: https://habr.com/ru/post/1259151/


All Articles