无法将函数引用传递给框架中的表单

Sys*_*mes 4 delphi

我有一个我正在构建的应用程序,它有一个带有几个创建的TabSheets的PageControl,我在其上放置了几个预定义的框架.每个框架中都有一个名为"GetValue"的例程,它将其控件的内容解析为字符串并返回结果.在主表格(RGMain)上我有:

Type
   TGetValueFunction = Function: String;
...   
Private
   fGetValueFunction: TGetValueFunction;
...      
Public
   Property GetValueFunction: TGetValueFunction Write fGetValueFunction;
Run Code Online (Sandbox Code Playgroud)

在我拥有的每个框架中:

Public
Constructor Create(AQwner: TComponent);
...
Interface
Constructor TBooleanChoiceFrame.Create(AOwner: TComponent);
   Begin
   Inherited Create(AOwner);
   RGMain.GetValueFunction := GetValue; <<<< compile error on this line
   End;
Run Code Online (Sandbox Code Playgroud)

E2009不兼容的类型:'常规过程和方法指针'

除了纠正问题之外,这是解决每个帧中访问GetValue例程的问题的正确方法吗?

Uwe*_*abe 6

如果要使用类的方法,则必须声明函数类型,如下所示:

Type
   TGetValueFunction = Function: String of object;
Run Code Online (Sandbox Code Playgroud)