I have a virtual TListView which has an TImageList assigned to it. The item.ImageIndex is set on the OnData event. The listview is read only and has RowSelect as true and is displaying in vsReport ViewStyle.
When I select a row and then select a second row, the icon of the first row remains with the selected coloured background. If I move the mouse over it (so that the paler 'selectable' background appears) and then move the mouse off without selecting anything the background returns to white as normal.
The bug seems to occur when setting the image via either smallImages/ImageIndex or StateImages/StateIndex
Is this a known bug and are there any workarounds? I've tried putting a refresh event under OnSelectItem, though this appears to be buggy as when I'm passed the 'not selected' TListItem, the Item parameter is always nil (the 'selected' pass works fine, though, and both work for non-virtual mode).
This is occurring in Delphi XE2, which is the latest version I have available. If it's still present in later versions then I can raise a bug report.
One other mitigating factor that may have some influence: The application is skinned using DevExpress skinning libraries. This shouldn't affect the OnSelectItem bug though.
edit: Reproduced in a simple example of form with Listbox and a 1-icon imagelist on it, with the following code:
procedure TForm28.FormCreate(Sender: TObject);
begin
listview1.Items.Count := 5;
end;
procedure TForm28.ListView1Data(Sender: TObject; Item: TListItem);
begin
item.Caption := 'item #' + inttostr(item.Index);
item.ImageIndex := 0;
end;
Listbox set to defaults apart from setting SmallImages and OwnerData=true and ViewStyle = report
With viewStyle as vsIcon I see a similar issue, with the selection highlight not being cleared 'high' enough leaving a blue border at the top of the item.
I wonder if this is an issue with the Windows version where Windows changed the styling of the component but Delphi controls the area to redraw? I'm using Win 8 Pro on this machine.