Jump to content


Photo

TPersistent Assign implementation


  • Please log in to reply
1 reply to this topic

#1 Roy

Roy
  • Members
  • 1 posts

Posted 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

#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,191 posts
  • Gender:Male

Posted 15 November 2010 - 10:34 PM

Hello Roy,

I have add this fix in official code. I will look on other places too.

Best regards
boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users