Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy the composite component fails to parent controls?
    primarykey
    data
    text
    <p>I created my own Component : TPage , which Contains Subcomponent TPaper (TPanel). The problem is, that when I put controls such as TMemo or TButton on the TPaper (which fills up nearly whole area), the controls do not load at all. see example below </p> <pre><code>TPaper = class(TPanel) protected constructor Create(AOwner: TComponent);override; destructor Destroy;override; public procedure Paint; override; end; TPage = class(TCustomControl) private FPaper:TPaper; protected procedure CreateParams(var Params:TCreateParams); override; public constructor Create(AOwner: TComponent);override; destructor Destroy;override; published property Paper: TPaper read FPaper write FPaper; end; constructor TPage.Create(AOwner: TComponent); begin inherited Create(AOwner); PaperOrientation:=poPortrait; PaperSize:=psA4; PaperBrush:=TBrush.Create; PaperBrush.Color:=clWhite; PDFDocument:=Nil; FPaper:=TPaper.Create(Self); FPaper.Parent:=Self; FPaper.SetSubComponent(True); end; </code></pre> <p>... Memo1 is parented in TPaper (TPanel) at design-time, but after pressing "Run" it does not exist.</p> <pre><code>procedure TForm1.btn1Click(Sender: TObject); begin if not Assigned(Memo1) then ShowMessage('I do not exist'); //Memo1 is nil end; </code></pre> <p>Have you any idea what's wrong?</p> <p>Thanks a lot</p> <p>P.S Delphi 7</p> <p>When I put TMemo inside TPaper and save the unit (Unit1), after inspection of associated dfm file, there is no trace of TMemo component. (Thats why it can not load to app.)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload