callmethod
hi, i am a problem with callmethod function.
Example:
SsCRIPT.AddMethod('function Anf_ValorT(Fieldname:string):Variant',CallMethod,EmptyStr,EmptyStr);
and callmethod is:
function CallMethod(Instance: TObject; ClassType: TClass; const
MethodName: String ; var Params: Variant): Variant;
function CallMethod(Instance: TObject; ClassType: TClass;
const MethodName: String ; var Params: Variant): Variant;
begin
if MethodName = 'ANF_VALORT' then
result:=Anf_valorT(Params[0])
end;
Error Delphi: incompatible types: method pointer and regular procedure
Why?
Example:
SsCRIPT.AddMethod('function Anf_ValorT(Fieldname:string):Variant',CallMethod,EmptyStr,EmptyStr);
and callmethod is:
function CallMethod(Instance: TObject; ClassType: TClass; const
MethodName: String ; var Params: Variant): Variant;
function CallMethod(Instance: TObject; ClassType: TClass;
const MethodName: String ; var Params: Variant): Variant;
begin
if MethodName = 'ANF_VALORT' then
result:=Anf_valorT(Params[0])
end;
Error Delphi: incompatible types: method pointer and regular procedure
Why?
Comments
I think the error is in your function Anf_valorT. The return of that is not equal that you create at
SsCRIPT.AddMethod('function Anf_ValorT(Fieldname:string):Variant',CallMethod,EmptyStr,EmptyStr);