Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

change color of listviewitem text in delphi

i'm trying to change the text color within my listviewitem for a text object. I have multiple text objects in the listviewitem. I'm using the below code

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

The error when debugging says inaccessible object yet i have no problem changing the color when i do the below

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

any ideas?

like image 905
ant theman Avatar asked Nov 02 '16 10:11

ant theman


1 Answers

Found the answer :

TListItemText(Litem.Objects.FindDrawable('ytde')).TextColor := TAlphaColorRec.Red;
like image 116
ant theman Avatar answered Nov 17 '22 01:11

ant theman