[fpc-pascal] How do I add a TComponent to TPanel dynamically?
dawessels at telkomsa.net
Thu Aug 28 00:06:06 CEST 2008
On Wo, 2008-08-27 at 14:52 +0100, Michael Green wrote:
> Hi Danie,
> Other than what was pointed out with create/destroy, wouldn't it create
> a memory leak with the NEW?
> > procedure TForm1.Button1Click(Sender: TObject);
> > begin
> > if pTopCV = nil
> > then begin
> > NEW( pTopCV );
> > pTopCV^ := TControlVolume.Create(PanelDraft);
> Instead, simply do:
> if not assigned(pTopCV) then begin
> pTopCV^ := TControlVolume.Create(Paneldraft);
> (Same goes for the pTopCV.next entry).
> -- Mike
I really do not know (but would like to) but it also does not work. -
crashes at the creation point. Can you get it to work?
More information about the fpc-pascal