Delphi-Quellcode:
var
SearchRec: TSearchRec;
Sortlist: TListbox;
i: integer;
begin
SortList := TListbox.create(self);
FindFirst(bmpfolder+'*.bmp', faAnyFile, SearchRec);
repeat
Sortlist.items.add(searchrec.Name);
until FindNext(searchrec) <> 0;
findclose(searchrec);
Sortlist.Sorted := true;
for i := 0 to Sortlist.Items.Count-1 do
begin
setlength(textures,length(textures)+1);
textures[high(textures)] := tglbmp.Create(bmpfolder+ SortList.Items.Strings[i]);
end;
Sortlist.free;
end;
so in etwa...
Edit: end gehört auch dazu.
Edit: das setlength aus der repeatschleife raus