TListView event OnSelectItem holds the wrong TListItem instance?

144 views Asked by At

The TListItem returned in OnSelectItem event of the TListView holds the previously selected item instead of the latest (current) one. Is It a bug? Tested in Linux Mint 17.2, Lazarus 1.4.4, FPC 2.6.4

Feed a TListView with some items first...

procedure TForm1.ListView1SelectItem(Sender: TObject; Item: TListItem; Selected: Boolean);
begin
    Form1.Caption := Item.Caption;
end;
1

There are 1 answers

0
Vassilis On

I had to use the selected parameter. The event gets called multiple times, with the old item and selected=False, and the actual item with Selected=ON.

When coming from Delphi, it happens.