-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