Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 546713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T10:53:46+00:00 2026-05-13T10:53:46+00:00

//I do not know how to ask the question better…// I registred new class

  • 0

//I do not know how to ask the question better…//

I registred new class of my own (TDisplay). Inside of this class is one object (TRectangle – also of my own), which is created in the constructor of TCustomDisplay – predecestor of TDisplay.

When I put TDisplay on the form, I can edit all published properties of both my objects (TDisplay, TRectangle) as usual, but only TDisplay is set up according to the object inspector. TRectangle remains in its default values (left 0, Top 0 right 30, bottom 20), in spite of it, that these properties are set to left 0, Top 0 right 100, bottom 100.

What should I check to make it run correctly?

thanx

P.S
When the properties defined in object inspector are actually loaded into an object?

Here is the sample code (“short one”). It is not “clean” so please, be tolerant…

TRectangle = class(TComponent)
  private
    FOnAdjustContent: TNotifyEvent;
    FLeft, FRight, FBottom, FTop:Integer;
    FoutLeft, FoutRight, FoutBottom, FoutTop:integer;
    FinLeft, FinRight, FinBottom, FinTop:integer;
    FAligning:TAligning;
    FAdjustContent:TAdjustContent;
    FAnchors:TAnchors;
    FList:Tlist;
    FRectangleContainer:TRectangleContainer;
    FParentRectangle:TRectangle;
    FdLeft, FdTop, FdBottom, FdRight: integer;
 //   function FindParent(AName:string):TRectangle;


  public    
    constructor Create(AOwner:TComponent);override;
    destructor Destroy; override;
    procedure Assign(Source : TPersistent); override;
  published
    property AdjustContent:TAdjustContent read FAdjustContent write SetAdjustContent;
    property Aligning:TAligning read FAligning write SetAlign;
    property Anchors:TAnchors read FAnchors write SetAnchors;
    .
    .
    .   
  end; 



TTextObject = class (TRectangle)
  public
      procedure   Assign(Source : TPersistent); override;
  published
      property AlignmentInCell:integer read FAlignmentInCell write FAlignmentInCell;
      property Brush:TBrush read FBrush write FBrush;
      property CanMove:Boolean read FCanMove write FCanmove;
      .
      .
      .
  end;





TCustomDisplay = class (TCustomControl)
  private
     FRootTextObject:TTextObject;
     procedure SetRootTextObject(Value:TTextObject);
  protected
  public
     constructor Create(AOwner:TComponent); override;
     destructor  Destroy; override;
     procedure Assign(Source:TPersistent); override;
  published
     property RootTextObject:TTextObject read FRootTextObject write SetRootTextObject;
  end;



  TDesignDisplay = class (TCustomDisplay)
    protected
     procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
     procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
     procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
    public
     procedure Paint; override; 
    end;

  TDisplay = class (TCustomDisplay)
     private

        function  GetFirstMovable: TTextObject;
     protected
        procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
        procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
        procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
     public
        procedure Paint; override;
     end;


procedure Register;
begin
  RegisterComponents('My Palette', [TDisplay, TDesignDisplay]);
end;



constructor TCustomDisplay.Create(AOwner:TComponent);
  var i:integer;
  begin
  inherited;

  FRootTextObject:=TTextObject.Create(Self);
//  ShowMessage(FRootTextObject.Name);
//  FRootTextObject.Name:='Root';
  FRootTextObject.OnAdjustContent:=DoAdjustContent;

//  FRootTextObject.Right:=Width;
//  FRootTextObject.Bottom:=Height;
  FRootTextObject.CanMove:=False;
  TabStop:=True;
  end;



procedure TCustomDisplay.SetRootTextObject(Value:TTextObject);
begin
  FRootTextObject.Assign(Value);
end;




procedure TRectangle.Assign(Source: TPersistent);
var ARectangle:TRectangle;
begin
  if Source is TRectangle then
    begin
   ARectangle:=Source as TRectangle;

 //  Name:=ARectangle.Name;
  // FRect:=Rectangle.Rect;
   FLeft:=ARectangle.Left;
   FTop:=ARectangle.Top;
   FRight:=ARectangle.Right;
   FBottom:=ARectangle.Bottom;
   FoutLeft:=ARectangle.outLeft;
   FoutTop:=ARectangle.outTop;
   FoutRight:=ARectangle.outRight;
   FoutBottom:=ARectangle.outBottom;
   FinLeft:=ARectangle.inLeft;
   FinTop:=ARectangle.inTop;
   FinRight:=ARectangle.inRight;
   FinBottom:=ARectangle.inBottom;
   end
   else
    inherited;
end;



procedure TTextObject.Assign(Source : TPersistent);
var ATextObject:TTextObject;
begin
      inherited;
      if Source is TTextObject then
        begin
        ATextObject:=Source as TTextObject;

        AlignmentInCell:=ATextObject.AlignmentInCell;
        AttachedWP:=ATextObject.AttachedWP;
        Brush.Assign(ATextObject.Brush);
        Caption:=ATextObject.Caption;
        Font.Assign(ATextObject.Font);
        Painting.Assign(ATextObject.Painting);
        Pen.Assign(ATextObject.Pen);
        RichString:=ATextObject.RichString;
        StateDrawing:=ATextObject.StateDrawing;
        TabState:=ATextObject.TabState;
        TextFormat:=ATextObject.TextFormat;
        Thickness:=ATextObject.Thickness;
        Transparent:=ATextObject.Transparent;
        Value:=ATextObject.Value;
        WPname:=ATextObject.WPname;
        end;         
end;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T10:53:47+00:00Added an answer on May 13, 2026 at 10:53 am

    Make sure TRectangle is derived from TPersistent class or one of its descendant classes. Also make sure you implemented Assign method for TRectangle, and all the published properties of TRectangle are assigned inside Assign method.

    NOTE: If your class is derived from TComponent, and is used as a child component inside another component, you should call SetSubComponent(True) when the object is created.

    The code should look something like this:

    Interface section:

      type    
        TRectangle = class(TComponent)
          private
            FTop,
            FBottom,
            FLeft,
            FRight   : Integer;
          public
            procedure Assign(Source: TPersistent); override;
          published
            property Bottom: Integer read FBottom write FBottom;
            property Left: Integer read FLeft write FLeft;
            property Right: Integer read FRight write FRight;
            property Top: Integer read FTop write FTop;
          end;
    
          TDisplay = class(TComponent)
          private
            FRectangle : TRectangle;
            procedure SetRectangle(Value: TRectangle);
          public
            constructor Create(AOwner: TComponent); override;
            destructor Destroy; override;
          published
            property Rectangle: TRectangle read FRectangle write SetRectangle;
          end;
    

    Implementation section:

    { TRectangle }
    
    procedure TRectangle.Assign(Source: TPersistent);
    begin
      if Source is TRectangle then
      begin
        FBottom := TRectangle(Source).Bottom;
        FLeft := TRectangle(Source).Left;
        FRight := TRectangle(Source).Right;
        FTop := TRectangle(Source).Top;
      end
      else
        inherited;
    end;
    
    { TDisplay }
    
    constructor TDisplay.Create(AOwner: TComponent);
    begin
      inherited;
      FRectangle := TRectangle.Create(Self);
      FRectangle.Parent := Self;
      FRectangle.SetSubComponent(True);
    end;
    
    destructor TDisplay.Destroy;
    begin
      inherited;
    end;
    
    procedure TDisplay.SetRectangle(Value: TRectangle);
    begin
      FRectangle.Assign(Value);
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not sure how to ask the question, for I don't know what I
as google does not deliver what i want to know, i try to ask
I was asked a question in C last night and I did not know
This just won't work. The problem is that I do not know enough to
If you do not know what Pipe Viewer is (I did not know about
I know many people who use computers every day, who do not know how
I faced a little trouble - I do not know if I can define
To recap for those .NET gurus who might not know the Java API: ConcurrentHashMap
I have seen 3d surface plots of data before but i do not know
If I had the following select, and did not know the value to use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.