[Lazarus] How do I Show Dynamically Created Visual Components?

Andrew Brunner andrew.t.brunner at gmail.com
Fri Jan 15 20:23:35 CET 2010

You have to set the parent of the component before you will be able to see
or Parent:=Form1 should do.

2010/1/15 Dennis M. Linton <dennis at dmlinton.net>

>  I am having trouble figuring out how to show visual components created
> programmatically.  I seem to be able to, for example, do this:
> An integer, i, is declared in the public section.
>     with TEdit.Create(Form1) do begin
>         Visible:=True;
> `      Enabled:=True;
>         Name:='TestEdit"+IntToStr(i);
>         Show;    //tried this in desperation but no success.
>         Form1.Refresh    //this did not produce a visible new component
> either.
>     end;
> The edit box seems to be created as Form1.ComponentCount increases and the
> Name generated is shown in another edit box.
> My problem is that I cannot get the new edit box to be visible (I even had
> code to ensure that .Top and .Left were such that the new component would be
> located within the Form1 coordinates.  Can anyone tell me what I am doing
> wrong.
> Thanks in advance.
> Best regards,
>     Dennis
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20100115/f23b1d18/attachment-0004.html>

More information about the Lazarus mailing list