Hello

Hello,

I've successfully binded a TObjectList to my Listview (thanks to http://www.malcolmgroves.com/blog/?p=1084 ). My TTask object is really simple : TTask.Id and TTask.Task.

I want to display my Task when a user double click on a listview item.
I want to use the "OnItemClick" event to retrieve data of the selected item.

I'm using this code :

procedure lvItemClick(const Sender: TObject;
const AItem: TListViewItem);
var
Adapter : TBindSourceAdapter;
begin
Adapter := TaskAdapter.InternalAdapter;
showmessage( Adapter.FindField('Task').GetTValue.ToString);
end;

My issue is that showmessage is always displaying data from the first task object of my list.

How can I sync my bindsource adapter so that it's position reflect the selected listview item ?

Thanks you

Comments