Search code examples
delphifiremonkeytlistview

TListView and Multiple Buttons


Writing an FMX app and using the following documentation...

http://docwiki.embarcadero.com/RADStudio/Berlin/en/Customizing_FireMonkey_ListView_Appearance

I'd like to place multiple images or buttons in each ListViewItem and determine which one is pressed.

enter image description here

Is there a way on the selected item to determine which button/image was pressed?

For example, when I click the item I may want to do some default (like show detail) vs if they click the image/button - do something else

And there's no click events either... enter image description here


Solution

  • You can use OnItemClickEx event, it passes part of item that was clicked.

    procedure TForm1.ListView1ItemClickEx(const Sender: TObject; ItemIndex: Integer;
      const LocalClickPos: TPointF; const ItemObject: TListItemDrawable);
    begin
      ShowMessage(ItemObject.Name);
    end;