spring4dのコレクション部分の使用を開始しようとしています。ただし、コレクション変更イベントをサブスクライブできません。エラーを取得します:[DCCエラー]:E2008互換性のないタイプ:
var
TestList: TObjectList<TObject>;
begin
... List initialization code ...
TestList.OnNotify.Add(TestHandler); <--- Error here
end
TObjectListのOnNotifyプロパティは、次のように宣言されています。
property OnNotify: ICollectionNotifyDelegate<T>
、 どこ
ICollectionNotifyDelegate<T> = interface(IMulticastEvent<Generics.Collections.TCollectionNotifyEvent<T>>)
end;
つまり、OnNotify.Addメソッドは、次のように宣言されたGenerics.Collections.TCollectionNotifyEventを予期します。
TCollectionNotifyEvent<T> = procedure(Sender: TObject; const Item: T;
Action: TCollectionNotification) of object;
私のイベントハンドラーは次のように宣言されています:
procedure TTestClass.TestHandler(Sender: TObject; const Item: TObject; Action: TCollectionNotification);
begin
end;
私は混乱しています%)助けてください)