我正在开发一个应用程序,其中包含一个PageControl控件,上面有多个TabSheet选项卡。在每个TabSheet选项卡上,我会放置一些预定义的框架。每个框架中都有一个名为“GetValue”的例程,它将其控件的内容解析为字符串并返回结果。在主窗体(RGMain)中,我有以下代码:
Type
TGetValueFunction = Function: String;
...
Private
fGetValueFunction: TGetValueFunction;
...
Public
Property GetValueFunction: TGetValueFunction Write fGetValueFunction;
在每个Frame中,我都有以下内容:
Public
Constructor Create(AQwner: TComponent);
...
Interface
Constructor TBooleanChoiceFrame.Create(AOwner: TComponent);
Begin
Inherited Create(AOwner);
RGMain.GetValueFunction := GetValue; <<<< compile error on this line
End;
E2009 不兼容类型:'常规过程和方法指针'
除了纠正问题之外,这是否是解决在每个框架中获取GetValue例程访问权限的正确方法?