1

I need some example how to change color text item for each row from my list view in FireMonkey.

I try something like this but unsuccessfully.

 for i := 0 to lvArtikli.ItemCount-1 do
        begin

          AItem := lvArtikli.Items.AppearanceItem[i];

          pk := AItem.Data['txtPK'].AsString;

          if pk = '' then
          begin
             //change color
            TListItemText(AItem.Objects.FindDrawable('txtPK')).TextColor := TAlphaColorRec.Red;

          end;

  end;
4

1 回答 1

0

In order to color a certain column, and for each row it is necessary to put the following code on event onUpdateObjects.

procedure TfrmMeni.lvKorektivnoUpdateObjects(const Sender: TObject;const AItem: TListViewItem);
begin

TListItemText(AItem.Objects.FindDrawable('txtPK') as TListItemText).TextColor:= TAlphaColorRec.Gold;

end;
于 2018-02-23T07:47:59.857 回答