Delphi-PRAXiS
Seite 1 von 2  1 2      

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Listview OwnerData (https://www.delphipraxis.net/57224-listview-ownerdata.html)

lucius 17. Nov 2005 13:39


Listview OwnerData
 
Hallo Leute,

Ich habe eine Listview die wird mit 600 Eintraegen gefuehlt, die Property OwnerData steht auf false.
Ich muss OwnerData auf false setzen weil sonst die Eintraege nicht zu sehen sind.
Jetzt geht mir das befuellen der Liste zu langsam +- 3 Sekunden, ich moechte aber das das befuellen so schnell wie moeglich geht, ich erreiche das unterandern durch OwnerData auf true zu setzen aber dan sind die Eintraege nicht mehr zu sehen.
Hier der Code der die Liste befuellt.
Delphi-Quellcode:
procedure THaupt.Button1Click(Sender: TObject);
Var
i: Integer;
listitem : TListItem;
z: TStrings;
begin
if FileExists(label17.caption + 'rss.xml') then
 Begin
 Listview.Clear;
 Listbox1.Clear;
 Listbox2.Clear;
  SimpleRSS.LoadFromFile(label17.caption + 'rss.xml');
    For i := 0 to SimpleRSS.Items.Count - 1 do
      Begin
      z := CreateStrings(SimpleRSS.Items.Items[i].Description);
      Listbox1.Items.Add(SimpleRSS.Items.Items[i].Link);
      listitem := listview.Items.add;
      listitem.Caption := IntToStr(Succ(i));
      z.Values['Added'] := Parse(' ', z.Values['Added'], 1);
      listitem.SubItems.add(z.Values['Added']);
      listitem.SubItems.add(z.Values['Category']);
      listitem.SubItems.add(SimpleRSS.Items.Items[i].Title);
      listitem.SubItems.add(z.Values['Size']);
      listitem.SubItems.add(z.Values['Status']);
      listitem.SubItems.add(z.Values['Speed']);
      Listbox2.Items.add(z.Values['Download']);
      Groupbox2.Caption := 'Aantal torrents: ' + IntTostr(SimpleRSS.Items.Count);
      z.Free;
      Listview.Invalidate;
      end;
 end;
end;
Was kann/muss ich aendern damit ich OwnerData auf true setzen kann oder die Befuellung schneller geht?
Oja Listview.Items.BeginUpdate, EndUpdate hat keinen Zweck, schon probiert.
Danke im voraus.

Gruss Lucius.

mumu 17. Nov 2005 13:42

Re: Listview OwnerData
 
folgendes sollte helfen
Delphi-Quellcode:
procedure THaupt.Button1Click(Sender: TObject);
Var
i: Integer;
listitem : TListItem;
z: TStrings;
begin
if FileExists(label17.caption + 'rss.xml') then
Begin
Listview.Clear;
Listbox1.Clear;
Listbox2.Clear;
SimpleRSS.LoadFromFile(label17.caption + 'rss.xml');
 
[color=#ff0000]ListView.BeginUpdate;[/color]

   For i := 0 to SimpleRSS.Items.Count - 1 do
   Begin
      z := CreateStrings(SimpleRSS.Items.Items[i].Description);
      Listbox1.Items.Add(SimpleRSS.Items.Items[i].Link);
      listitem := listview.Items.add;
      listitem.Caption := IntToStr(Succ(i));
      z.Values['Added'] := Parse(' ', z.Values['Added'], 1);
      listitem.SubItems.add(z.Values['Added']);
      listitem.SubItems.add(z.Values['Category']);
      listitem.SubItems.add(SimpleRSS.Items.Items[i].Title);
      listitem.SubItems.add(z.Values['Size']);
      listitem.SubItems.add(z.Values['Status']);
      listitem.SubItems.add(z.Values['Speed']);
      Listbox2.Items.add(z.Values['Download']);
      Groupbox2.Caption := 'Aantal torrents: ' + IntTostr(SimpleRSS.Items.Count);
      z.Free;
      Listview.Invalidate;
   end;

[color=#ff0000]ListView.EndUpdate;[/color]
 
end;
end;

lucius 17. Nov 2005 13:49

Re: Listview OwnerData
 
Hi mumu, deine Erweiterung klappt nicht und muesste es nicht Listview.Items.BeginUpdate sein?

mumu 17. Nov 2005 13:50

Re: Listview OwnerData
 
ja natürlich, sorry...
ListView.Items.BeginUpdate;
...
ListView.Items.EndUpdate;

mumu 17. Nov 2005 13:51

Re: Listview OwnerData
 
Zitat:

Oja Listview.Items.BeginUpdate, EndUpdate hat keinen Zweck, schon probiert.
oops hab ich ja ganz überlesen... sorry :oops:

lucius 17. Nov 2005 13:54

Re: Listview OwnerData
 
BeginUpdate und EndUpdate hat keinen Zweck, ich muesste irgendwie OwnerData auf TRUE kriegen koennen denke ich, dan waehre die Listview auch schneller aber wie?

Luckie 17. Nov 2005 13:54

Re: Listview OwnerData
 
Zitat:

Zitat von lucius
Ich muss OwnerData auf false setzen weil sonst die Eintraege nicht zu sehen sind.

Warum gibt s denn dann diese Eingeschaft? hast du dich das noch nicht gefargt? Guck mal im Delphi verzeichnis bei den Demos, da gibt es eine Demo zum Virtuall Listview.

lucius 17. Nov 2005 14:01

Re: Listview OwnerData
 
Hi Luckie, also ich muesste den code von Button1.Click in ListViewData eintragen?
Und wie greife ich dan ueber den Befehl Button1.Click auf die Listview zu damit ListViewData ausgefuehrt wird?

lucius 17. Nov 2005 14:24

Re: Listview OwnerData
 
So ich habe jetzt folgendes gemacht in ListviewData:
Delphi-Quellcode:
procedure THaupt.ListViewData(Sender: TObject; Item: TListItem);
Var
i: Integer;
listitem : TListItem;
z: TStrings;
begin
      z := CreateStrings(SimpleRSS.Items.Items[i].Description);
      listitem := listview.Items.add;
      listitem.Caption := IntToStr(Succ(i));
      z.Values['Added'] := Parse(' ', z.Values['Added'], 1);
      listitem.SubItems.add(z.Values['Added']);
      listitem.SubItems.add(z.Values['Category']);
      listitem.SubItems.add(SimpleRSS.Items.Items[i].Title);
      listitem.SubItems.add(z.Values['Size']);
      listitem.SubItems.add(z.Values['Status']);
      listitem.SubItems.add(z.Values['Speed']);
      z.Free;
end;
und in Button1.Click:
Delphi-Quellcode:
if FileExists(label17.caption + 'rss.xml') then
 Begin
 Listview.Clear;
 Listbox1.Clear;
 Listbox2.Clear;
  SimpleRSS.LoadFromFile(label17.caption + 'rss.xml');
    For i := 0 to SimpleRSS.Items.Count - 1 do
      Begin
      Listview.Items.Count := SimpleRSS.Items.Count;
      Listview.Repaint;
      end;
 end;
OwnderData steht jetzt auf TRUE.
Aber ich bekomme nen Stack Overflow??
Bitte Hilfe.

lucius 17. Nov 2005 21:43

Re: Listview OwnerData
 
Gibt es niemand der mir da helfen kann?
Waehre sehr wichtig.


Alle Zeitangaben in WEZ +1. Es ist jetzt 18:41 Uhr.
Seite 1 von 2  1 2      

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz