Einzelnen Beitrag anzeigen

Benutzerbild von DGL-luke
DGL-luke

Registriert seit: 1. Apr 2005
Ort: Bad Tölz
4.149 Beiträge
 
Delphi 2006 Professional
 
#2

Re: Steuerelementefeld zur Entwicklungszeit

  Alt 8. Okt 2006, 13:31
Du redest von "array of TControl"? Würde ich so machen:

Delphi-Quellcode:
function CollectControls(OfClass: TClass; Parent: TWinControl): array of TControl;
var arraypos: Integer;
    
begin
  //Init
  Setlength(Result, Parent.ControlCount);
  arraypos := 0;

  //Controls durchsuchen, wenn richtige Klasse gefunden, array hinzufügen
  for i := 0 Parent.ControlCount -1 do
    if Parent.Controls[i] is OfClass then
    begin
      Result[arraypos] := Parent.Controls[i];
      Inc(arraypos);
    end;

  //array trimmen
  Setlength(Result,arraypos+1);
end;
"Sammelt" alle Controls, die in einem Container (Parent) liegen und von einer bestimmten Klasse (OfClass) sind. Sollte es.
Lukas Erlacher
Suche Grafiktablett. Spenden/Gebrauchtangebote willkommen.
Gotteskrieger gesucht!
For it is the chief characteristic of the religion of science that it works. - Isaac Asimov, Foundation I, Buch 1
  Mit Zitat antworten Zitat