Jump to content


Roy

Member Since 03 Nov 2010
Offline Last Active Nov 22 2010 07:18 PM
-----

Topics I've Started

TPersistent Assign implementation

15 November 2010 - 06:10 PM

Currently the Assign procedure of the TPersistent derived classes aren't implemented.
When assigning new values to a property of a component, for instance NextGrid.InnerMargins, it's not possible to assign an existing TNxMargins instance to this component.
This results in copying al properties of TNxMargins to the NextGrid instead of just assigning it using the TPersistent.Assign procedure.

CODE
procedure TNxMargins.Assign(Source: TPersistent);
begin
  if (Source is TNxMargins) then
  begin
    Left:=TNxMargins(Source).Left;
    Right:=TNxMargins(Source).Right;
    Top:=TNxMargins(Source).Top;
    Bottom:=TNxMargins(Source).Bottom;
  end
  else
    inherited Assign(Source);
end;


Is it possible to implement this procedure for all derived TPersistent classes?

Best regards,
Roy