How can I change the image when I click on the created DynamicAppearance -> Item -> TImageObjectApperance.
I would like to add two buttons and I will also need to capture the event so that clicks return the name of the component to which the ListView clicks and id values are clicked?
Thank you
Delphi-Quellcode:
procedure TfrmMain.ListView1ItemClick(const Sender: TObject;
const AItem: TListViewItem);
begin
lvItem := AItem;
end;
procedure TfrmMain.ListView1ItemClickEx(const Sender: TObject;
ItemIndex: Integer; const LocalClickPos: TPointF;
const ItemObject: TListItemDrawable);
var
str: string;
ch: boolean;
begin
if (LocalClickPos.X > (ListView1.Width - 50)) and (LocalClickPos.Y > 150) then
begin
str := lvItem.Detail;
if lvItem.Objects.FindObjectT<TListItemImage>('imgMini').Bitmap = imageNo.Bitmap then
begin
lvItem.Objects.FindObjectT<TListItemImage>('imgMini').Bitmap := imageYes.Bitmap;
ch := True;
end else
begin
lvItem.Objects.FindObjectT<TListItemImage>('imgMini').Bitmap := imageNo.Bitmap;
ch := False;
end;
end;
if ch = False then
begin
Query1.ExecSQL('UPDATE select_table SET isChecked = 0, id_value = '+QuotedStr(str)+';');
end else
begin
Query1.ExecSQL('UPDATE select_table SET isChecked = 1, id_value = '+QuotedStr(str)+';');
end;
end;