W jaki sposób w listbox zrobić

0

żeby mi numerował każdy dodany plik ?

0

Listbox.items.add('Jakiś plik albo zmienna');

I on wtedy dodaje do listboxa np. na pozycji 1, to wtedy będzie listbox.items[1] [cya]

*Wiesz co to jest edytowanie swoich postów??? TAKA IKONKA --> user image

hehe, już wiem

0

ostrzegam ze to niebylo testowane w zaden sposob :)

var i:integer;
begin
if opendialog.execute then
for i:=0 to opendialog.files.count-1 do listbox1.items.add(inttostr(i)+'. '+opendialog.files.strings[i]);
end;

teraz przy usuwaniu są odstepy przy numerowaniu np. 1. ---- 6. ---- oto procedura poprawiająca:

procedure refresh;
var i:integer;ss:string;tmp:tstringlist;
begin
tmp:=tstringlist.create;
for i:=0 to listbox1.items.count-1 do
begin
ss:=copy(listbox1.items.strings[i],pos('.',listbox1.items.strings[i]),length(listox1.items.strings[i]));
tmp.add(ss);
end;
listbox1.items.clear;

for i:=0 to tmp.count-1 do
listbox1.items.add(inttostr(i)+'. '+tmp.strings[i]);

end;

jak cos to na irca albo na gg (1263497) ;p

0

procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
var i : Integer;
begin
for i := 0 to (ListBox1.Count - 1) do
begin
ListBox1.Items.Strings[i] := IntToStr(i + 1) + '. ' + ListBox1.Items.Strings[i];
end;
end;

Ale ostrzegam - nie testowane...

1 użytkowników online, w tym zalogowanych: 0, gości: 1