es gibt eine recht einfache möglichkeit
Delphi-Quellcode:
procedure StarteRoutineByName(Instance : TObject; Name : string); //instance z.b. Form1
type
TExecute = procedure of object;
var
Routine : TMethod;
Execute : TExecute;
begin
Routine.Data := Pointer(Instance);
Routine.Code := Instance.MethodAddress(Name);
if Routine.Code = nil then Exit;
Execute := TExecute(Routine);
Execute;
end;
und damit die sache perfekt ist
Delphi-Quellcode:
function FindFormByName(Formname : string) : Tform;
var
i : byte;
begin
result := nil;
for i := 0 to screen.FormCount-1 do if screen.Forms[i].Name = Formname then
begin
result := screen.Forms[i];
break;
end;
end;
Thomas H.