If someone can help me, I have a problem with a method of ListView
, the method is TForm13.ListView1UpdateObjects
in it I do the following: I check the value of an item to decide whether to show an item and concatenate the item to display.
Follow the code:
procedure TForm13.ListView1UpdateObjects(const Sender: TObject;
const AItem: TListViewItem);
var
ItemText_parcelar_cartao : TListItemText;
ItemText_valor_parc : TListItemText;
ItemText_quant_parc : TListItemText;
concat : TListItemText;
begin
ItemText_parcelar_cartao := AItem.Objects.FindObject('Text_parcelar_cartao') as TListItemText;
ItemText_valor_parc := AItem.Objects.FindObject('Text_valor_parcela') as TListItemText;
ItemText_quant_parc := AItem.Objects.FindObject('Text_quant_parcela') as TListItemText;
concat := AItem.Objects.FindObject('Text_concat') as TListItemText;
if ItemText_parcelar_cartao.text = 'sim' then
begin
concat.visible := true;
concat.text := 'ou ' + ItemText_quant_parc.text + 'x de ' + ItemText_valor_parc.text;
end
else
concat.visible := false;
end;
The problem is this: this ListView
is connected to a FDMemTable
principal, when I load FDMemTable
with the data initially, everything works fine, and in another step I add more records to FDMemTable
principal coming from an auxiliary% wizard, with the following function:
FDMemTable_produto_por_desc.AppendData(FDMemTable_produto_por_desc_pagina.Data, true);
When I add the new records, the FDMemTable
function is executed, and it is at that moment that the error occurs, the variable TForm13.ListView1UpdateObjects
is empty and does not receive the value of the ItemText_parcelar_cartao.text
field, and consequently it does not tests and does not concatenate correctly.