Hi everyone,
got a weird behavior of the compiler related to Event affectation and inheritance and/or linking of units.
Got some unit with a class in which I have some typical event definition :
Type
TSccMsgLogEvent = procedure (Agent, Msg, Str: String) of object;
TSccMessage = class(TSccObject)
private
...
vOnNotify: TSccMsgLogEvent;
public
...
Property OnNotify: TSccMsgLogEvent read vOnNotify write vOnNotify;
end;
and some list class which is intended to load several TSccMessage, in which I got an implementation procedure for the event :
(in list class) Procedure MessageLog (Agent, Msg, Str: String);
then, when I affect the event property (in list class's loading procedure) :
Msg.OnNotify:= @MessageLog;
Everything works as expected. BUT!
If I move the OnNotify event definition into the mother class of TSccMessage (so in TSccObject class [with FOnNotify in protected section], which is defined in another unit, so I also move the event type definition into that unit), then the compiler refuses to compile that same above line, saying :
expected procedure (ShortString,ShortString,ShortString) of object; ... got procedure (AnsiString,AnsiString,AnsiString) of object
Is it related to some kind of unit linking property which would transform Strings into ShortStrings...? a limitation of the compiler...? something else...?
Any thought accepted