Search code examples
delphic++buildervcltlistview

TListView & selection highlighting


Is there any (easy) way to suppress the blue selection of a selected TListView item (VCL)?

enter image description here


Solution

  • In the OnSelectItem() event, set Selected := False;. Alternatively also Focused:=False; for the Item parameter.

    procedure TForm10.ListView1SelectItem(Sender: TObject; Item: TListItem;
      Selected: Boolean);
    begin
    //  item.Focused:=False;
      item.selected:=False;
    end;
    

    enter image description here

    If you don't want to see the focus rectangle either, uncomment the first line in the code.