Einzelnen Beitrag anzeigen

Popov
(Gast)

n/a Beiträge
 
#13

AW: listview realtime daten anzeige

  Alt 29. Jun 2015, 17:23
Delphi-Quellcode:
var
  i : Integer;
  a: array[0..4] of Integer;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Timer1.Interval := 10;
  i := 0;
  ListView1.Items.Count := 5;
  ListView1.DoubleBuffered := True;
end;

procedure TForm1.ListView1Data(Sender: TObject; Item: TListItem);
begin
  Item.Caption := 'Test ' + IntToStr(Item.Index);
  Item.SubItems.Add('SubItem ' + IntToStr(a[Item.Index]));

  //Item.Caption := 'Test' + IntToStr(Item.Index);
  //Item.SubItems.Add('SubItem' + IntToStr(Item.Index));
end;

procedure TForm1.Timer1Timer(Sender: TObject);
var
  k: Integer;
begin
  for k := 0 to 4 do
  begin
    Inc(i);
    a[k] := i;
  end;
  ListView1.Refresh;

  //ListView1.Items.Item[ 0 ].SubItems.Strings[ 0 ] := IntToStr( i );
end;
  Mit Zitat antworten Zitat