[Lazarus] Nested Components in a Form at runtime

Mattias Gaertner nc-gaertnma at netcologne.de
Thu Feb 15 19:17:01 CET 2018


On Thu, 15 Feb 2018 19:03:37 +0100
Andreas Frieß via Lazarus <lazarus at lists.lazarus-ide.org> wrote:

> For testing purposes, i want to create a form at runtime with chained
> panels - to make it simple.
> 
> I use this code
> 
> 
>   // Create components
>   ATestForm :=  TForm.Create(nil);
>   ATestForm.Name:= 'Main';
>   // Create a Panel
>   ATestPanel := TPanel.Create(ATestForm);
>   ATestPanel.Parent:=ATestForm;
>   ATestPanel.Name:='PanelA';
>   ATestPanel.Caption:= 'Panel';
>   // Create in the panel a panel (to see the chain)
>   ATestPanelSub := TPanel.Create(ATestPanel);

Owner must be the form:
ATestPanelSub := TPanel.Create(ATestForm);


>   ATestPanelSub.Parent := ATestPanel;
>   ATestPanelSub.Name:= 'SubPanelA';
>   ATestPanelSub.Caption:= 'Sub Panel';
> 
> but in the ObjectInspector (used at runtime) i see only the PanelA, not
> the nested ATestPanel. What do i wrong or have misunderstood ?

Mattias


More information about the Lazarus mailing list