要求,该字符串对应的方法必须在类的publish区定义
function TfrmParent.CallFnByStr(const aFnName:string;Sender: TObject):boolean;
type
TExec = procedure of object;
var
iMthd: TMethod;
Exec: TExec;
begin
Result := False;
if Pos('_',aFnName)=0 then
begin
iMthd.Data := Self ;
iMthd.Code := self.MethodAddress(aFnName) ;
if iMthd.Code<> nil then
begin
Exec := TExec(iMthd) ;
Exec;
Result := true;
end;
end;
end;