Registriert seit: 2. Mär 2004
5.508 Beiträge
Delphi 5 Professional
|
AW: Frame-Name in Variable
24. Aug 2012, 11:51
Delphi-Quellcode:
// sucht eine Komponente anhand des Pfads (z.B. 'Main.Workshop1.WorkshopDetail1')
function FindComponentByPath(owner:TComponent; name:string):TComponent;
var
s : string;
p : Integer;
begin
if not Assigned(owner) then
begin
Result := nil;
Exit;
end;
p := Pos('.', name);
if p = 0 then
begin
Result := owner.FindComponent(name);
Exit;
end;
s := Copy(name, 1, p-1);
name := Copy(name, p+1, 999);
Result := owner.FindComponent(s);
if Assigned(Result) then
Result := FindComponentByPath(Result, name);
end;
Andreas
|
|
Zitat
|