Load database field of all records into ListView Item Detail Object

  

Using Delphi XE8 I’m currently testing functionality with Firemonkey TListViews.

One thing I’m trying to do is to load a field of all records from a TFDMemtable component into a Listview Item, specifically into the DetailObject of the ListView Item.

For example, I have 3 records in a table (db field is called ‘Name’):

Record 1 = Name 1
Record 2 = Name 2
Record 3 = Name 3

There is only 1 DetailObject property per ListView Item so my question is, would I be able to add all of the fields (Name 1, Name 2, Name 3) into that one DetailObject?

Below is what I’ve attempted so far but no luck. Not 100% sure what I need to do.

procedure MainForm.BuildList;
var LItem : TListViewItem;
begin
ListView1.BeginUpdate;
try
ListView1.CLearItems;
LItem := ListView1.Items.Add;
LItem.Objects.DetailObject.Visible := True;
with memtable do
begin
while not eof do
begin
LItem.Detail := FieldByName(‘Name’).AsString;
end;
end;
finally
ListView1.EndUpdate;
end;
end;

I’m sorry if this isn’t clear enough, please let me know.

Any help would be great.

Comments are closed.