Search code examples
androidiosdelphidelphi-xe8

TlistView OnItemClick selects first record on iOS


I'm writing an app for multi platforms - (iOS, Android, Windows) The main form contains a TListView which fetches database records via dataset - TFDMemTable.

Using the OnItemClick procedure for the TListView I am using a ShowMessage dialog box to display the record's text, just to indicate that what I'm pressing is the correct record.

This appears to work fine for Android and Windows however when I press a record on the ListView on iOS platform, the ShowMessage dialog box always displays the text of the very first record no matter which record I press.

This is all I'm doing when pressing the record:

procedure TForm.ListViewItemClick(const Sender: TObject;
const AItem: TListViewItem);
begin
  ShowMessage(DMod.InvTB.FieldByName('InvID').asString);
end;

Any suggestions?

Thanks,


Solution

  • Set AItem.tag to a relevant integer fieldname to identify the record.