Is it possible to set a item in a ShellListView to visible=false
? I thought About something like ShelLlistView.Items.visible(false)
but that does not exist and I have no idea for another solution so I hope someone can help me with this.
I can't post any Code for you yet because I don't have any ShellListView yet but I hope you can give me some advice how it could work.
Afaik, this is not possible because the ListItem
s shown in the TShellListView have no Visible
property. However, according to Peter Below (TeamB), you can effectively "hide" an item by destroying it. See http://www.delphigroups.info/2/67/290279.html
Of course, if you wish to "unhide" an item hidden in this way, you would need to create & add a new node with the same Caption
, etc.
This code works fine for me using the standard Lazarus TShellListView:
procedure TForm1.Button1Click(Sender: TObject);
var
Item : TListItem;
begin
Item := ShellListView1.Items[0];
Caption := Item.Caption;
Item.Free;
end;
and removes the first item in the list.
The following removes all the items in the ShellListView
. THe downto
is to account for the fact that the Count
value decreases on each iteration of the loop.
procedure TForm1.Button1Click(Sender: TObject);
var
i : Integer;
begin
for i := ShellListView1.Items.Count - 1 downto 0 do
ShellListView1.Items[i].Free;
end;