Board index » delphi » creating components within components

creating components within components

I want to create a TCustomControl (a coloured circle) with a caption and
an image area. (Delphi 3 Pro)

I have created the TCustomControl and I've tried adding a create
'CaptionLabel:Tlabel', firstly in the create method and then in the
paint method of my CustomControl. I have managed to compile both these
attempts but neither render the label when I instantiate a CustomControl
at run time. Firstly, is this the correct way to approach this? If it
is, what do I use as 'parent' for the CaptionLabel. Will the same
solution apply to an 'IconImage:TBitmap' or any other embellishments? If
possible I'd really appreciate a small but fully worked example or if
not, then the key points.

Thanks,

Greg

 

Re:creating components within components


for the captionlabel you should do something like
OnCreate
begin
  captionlabel:=Tlabel.Create(Self);
  captionlabel.parent:=Self;
  captionlabel.visible:=true;
  // set it's position
end;

for other components about the same applies.

HTH

  Roel

In comp.lang.pascal.delphi.misc Greg Lubel <"<NOSPAM> wrote:

Quote
> I want to create a TCustomControl (a coloured circle) with a caption and
> an image area. (Delphi 3 Pro)
> I have created the TCustomControl and I've tried adding a create
> 'CaptionLabel:Tlabel', firstly in the create method and then in the
> paint method of my CustomControl. I have managed to compile both these
> attempts but neither render the label when I instantiate a CustomControl
> at run time. Firstly, is this the correct way to approach this? If it
> is, what do I use as 'parent' for the CaptionLabel. Will the same
> solution apply to an 'IconImage:TBitmap' or any other embellishments? If
> possible I'd really appreciate a small but fully worked example or if
> not, then the key points.
> Thanks,
> Greg

Other Threads