* Add TReader.SetName for Delphi compatibility

This commit is contained in:
Michaël Van Canneyt 2024-02-14 18:02:45 +01:00
parent 3a1f180a56
commit 7506277dc1
2 changed files with 10 additions and 3 deletions

View File

@ -1845,6 +1845,7 @@ type
procedure ReadPropValue(Instance: TPersistent; PropInfo: Pointer);
procedure PropertyError;
procedure ReadData(Instance: TComponent);
procedure SetName(aComponent: TComponent; aName : string); virtual;
property PropName: rawbytestring read FPropName;
property CanHandleExceptions: Boolean read FCanHandleExcepts;
function CreateDriver(Stream: TStream; BufSize: Integer): TAbstractObjectReader; virtual;

View File

@ -923,6 +923,14 @@ begin
ReadListEnd;
end;
procedure TReader.SetName(aComponent: TComponent; aName : string);
begin
if Assigned(FOnSetName) then
FOnSetName(Self,aComponent,aName);
aComponent.Name:=aName;
end;
function TReader.ReadComponent(Component: TComponent): TComponent;
var
Flags: TFilerFlags;
@ -1022,9 +1030,7 @@ begin
if not (ffInherited in Flags) then
try
Result.SetParentComponent(Parent);
if Assigned(FOnSetName) then
FOnSetName(Self, Result, Name);
Result.Name := Name;
SetName(Result,Name);
if FindGlobalComponent(Name) = Result then
Include(Result.FComponentState, csInline);
except