简体   繁体   English

TShellListView拉撒路

[英]TShellListView Lazarus

Is it possible to set a item in a ShellListView to visible=false ? 是否可以将ShellListView中的项目设置为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. 我想到过类似ShelLlistView.Items.visible(false)东西,但是那不存在,我不知道其他解决方案,因此希望有人可以帮助我。

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. 我还不能为您发布任何代码,因为我还没有任何ShellListView,但是希望您能给我一些建议,以了解它如何工作。

Afaik, this is not possible because the ListItem s shown in the TShellListView have no Visible property. Afaik,这是不可能的,因为TShellListView中显示的ListItem没有Visible属性。 However, according to Peter Below (TeamB), you can effectively "hide" an item by destroying it. 但是,根据彼得·比尔夫特(Team B)的说法,您可以通过销毁物品来有效地“隐藏”物品。 See http://www.delphigroups.info/2/67/290279.html 参见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. 当然,如果您希望“取消隐藏”以这种方式隐藏的项目,则需要创建并添加具有相同Caption等的新节点。

This code works fine for me using the standard Lazarus TShellListView: 使用标准的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 . 以下内容删除ShellListView中的所有项目。 THe downto is to account for the fact that the Count value decreases on each iteration of the loop. downto是考虑到该事实Count的值在每次循环减少。

procedure TForm1.Button1Click(Sender: TObject);
var
  i : Integer;
begin
  for i := ShellListView1.Items.Count - 1 downto 0 do
    ShellListView1.Items[i].Free;
end; 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM