4

作成しているアプリケーションがあります。このアプリケーションには、いくつかの事前定義されたフレームを配置する、いくつかの作成されたTabSheetsを含むPageControlがあります。各フレームには、コントロールの内容を文字列に解析して結果を返す「GetValue」というルーチンがあります。メインフォーム(RGMain)には次のものがあります。

Type
   TGetValueFunction = Function: String;
...   
Private
   fGetValueFunction: TGetValueFunction;
...      
Public
   Property GetValueFunction: TGetValueFunction Write fGetValueFunction;

私が持っている各フレームには:

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ルーチンにアクセスする問題を解決する正しい方法でもありますか?

4

1 に答える 1

6

クラスのメソッドを使用する場合は、次のように関数型を宣言する必要があります。

Type
   TGetValueFunction = Function: String of object;
于 2012-09-30T12:37:33.393 に答える