-2
我有一个名为ListBoxPlayers的TListBox,我相信ListBoxPlayers.Items引用了TListBox中的TStrings列表。我正在尝试使用this函数,但它似乎不起作用。有任何想法吗?获取Lazarus中TStrings列表的长度
编辑: 所以我试图设置TListBox的大小取决于它将显示多少个字符串。这里是我的代码:
procedure TForm3.edtSearchChange(Sender: TObject);
begin
ListBoxPlayers.Clear;
if Length(edtSearch.text) > 0 then
begin
setSizeListBox((ListBoxPlayers.Items.Count));
ListBoxPlayers.Visible:=true;
dynamicSearch(edtSearch.Text)
end
else
ListBoxPlayers.Visible:=false;
end;
ListBoxPlayers.Items.Count
始终保持在0然而,许多项目也有在列表中。
定义“没有按似乎没有用“。显示你的代码。 –
它总是0.我已更新我的代码。 – user2412643
哈哈我是个白痴。忘记从一开始就删除ListBoxPlayers.clear。谢谢! – user2412643