I am unable to get CodeSite.Send to work with a variable declared as an interface. The compile time error is E2250 There is no overloaded version of 'Send' that can be called with these arguments.
How can I use interfaces with CodeSite?
Code example that demonstrates the problem:
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
end;
IMyInterface = Interface(IInterface)['{9BCD2224-71F8-4CE7-B04C-30703809FAAD}']
function GetMyValue : String;
property MyVaue : String read GetMyValue;
End;
MyType = class(TInterfacedObject, IMyInterface)
private
sValue : string;
function GetMyValue : String;
published
property MyVaue : String read GetMyValue;
end;
var
Form1: TForm1;
test : IMyInterface;
testType : MyType;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
test := MyType.Create;
testType := MyType.Create;
CodeSite.Send( 'testType', testType ); // This compiles
CodeSite.Send( 'test', test ); // Compiler error here
FreeAndNil(test);
end;
function MyType.GetMyValue : String;
begin
Result := Self.sValue;
end;