[ inherited @ 25.06.2006. 13:55 ] @
| Pogledajte primer i bice vam jasno sta mi treba. Treba da iz tri TEdita u TListView unesem vrednosti,
ali da mi se redni broj automatski pravi kako unosim vrednosti?
P.S. vrsio sam pretragu foruma ali nisam nasao ono sto mi treba...
Hvala unapred... |
[ bancika @ 25.06.2006. 17:35 ] @
var Item: tListItem;
begin
Item := List.Items.Add;
Item.Caption := IntToStr(List.Count);
Item.SubItems.Add(Edit1.Text);
Item.SubItems.Add(Edit2.TExt);
end;
[ inherited @ 25.06.2006. 21:16 ] @
OK, ovo lepo funkcionise, ali kako jos da dodam redne brojeve, npr:
1 Nesto Nesto...
2 Nesto Nesto...
[ Miloš Baić @ 26.06.2006. 10:49 ] @
I meni bi to bilo interesantno...
[ Srki_82 @ 26.06.2006. 12:18 ] @
Jedan od nacina.
[ inherited @ 26.06.2006. 14:25 ] @
To sto si odradio je OK, ali za TListBox, a meni treba za TListView... Pogledaj prvi primer.
[ inherited @ 26.06.2006. 15:13 ] @
Evo nesto sam sam smislio, ali treba pogledati, mislim da se to drugacije moze napisati, ali i ovako radi posao.
Pa, ako znate, ispravite...
[ Srki_82 @ 26.06.2006. 18:55 ] @
Zasto nisi ispravio primer da radi sa ListView?
Evo istog primera koji radi i za ListView.
[ bancika @ 26.06.2006. 20:10 ] @
Citat:
OK, ovo lepo funkcionise, ali kako jos da dodam redne brojeve, npr:
1 Nesto Nesto...
2 Nesto Nesto...
ne razumem, sta mu hvali. pravi redne brojeve?!
[ Miloš Baić @ 26.06.2006. 20:51 ] @
Verovatno je ovo bilo u pitanju:
Code:
procedure TfrmMain.lstTestDrawItem(Sender: TCustomListView;
Item: TListItem; Rect: TRect; State: TOwnerDrawState);
var
lstT: TListView;
intNoWidth: Integer;
strNoText: String;
begin
if Sender is TListView then
begin
lstT := Sender as TListView;
strNoText := IntToStr(Item.Index + 1) + '. ';
intNoWidth := Length(IntToStr(lstT.Items.Count)) + 3;
while Length(strNoText) < intNoWidth do
strNoText := '0' + strNoText;
strNoText := strNoText + Item.Caption;
lstT.Canvas.TextRect(Rect, Rect.Left + 1, Rect.Top + 1, strNoText);
end;
end;
[ inherited @ 29.06.2006. 14:01 ] @
Jos jedno pitanje, kad dodajem u TListView redove,npr:
1|DVDName|120
2|DVDName|120
3|DVDName|120
---------------
Item.Caption|[0]|[1] - SubItem
kako da saberem 120+120+120=360???
Copyright (C) 2001-2025 by www.elitesecurity.org. All rights reserved.