Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Indiziert Labels (https://www.delphipraxis.net/111595-indiziert-labels.html)

Peter Kaschubowski 6. Apr 2008 07:04


Indiziert Labels
 
Gibt es eine Möglichkeit Labels als Arrays zu indizieren, damit man in for Schleifen zu Direktausgaben kommen kann?
Gruss
Peter Kaschubowski

Der.Kaktus 6. Apr 2008 07:36

Re: Indiziert Labels
 
Gibt es...

z.B.:

Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var z,i:integer;
    a:Array[0..10] of TComponent; // mal als Beispiel nur 11
begin
 z:=-1;
 For i:=0 to form1.ComponentCount-1 do
 begin
  if (form1.Components[i] is TLabel) then
  begin
    inc(z);
    a[z]:=form1.Components[i];
  end;
 end;
 For i:=0 to z do (a[i] as TLabel).Caption:=IntTostr(i); //Bsp. Caption fuellen
end;


Alle Zeitangaben in WEZ +1. Es ist jetzt 00:14 Uhr.

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