Re: When to create TCustomControl's child controls?
- From: "Marc Rohloff" <marcrohloff_ng@xxxxxxxxxxx>
- Date: 26 Oct 2005 06:25:09 -0700
Riaan wrote:
> I need the dimensions in order to size the child controls on creation.
> How do I go about accomplishing this? I'm having to create resizing
> code for each child object on WM_SIZE, and this is not how it's
> supposed to be, I think. The properties and capabilities of the
> controls should be able to do the work for me automatically.
I generally create sub controls in the constructor, another place you
can do it is in the Loaded event.
You will have to handle resizing anyway since your control can be
resized both in the IDE and at run time.
> P.S. I've read that it is safer to give NIL as the owner, (i.e.
> fChildPanel := TPanel.Create(nil)).
No this is not really true. I would use 'self' as the owner, then you
don't have to worry about destroying the controls later.
--
Marc
.
- References:
- When to create TCustomControl's child controls?
- From: Riaan
- When to create TCustomControl's child controls?
- Prev by Date: Re: Version after Version
- Next by Date: Re: Version after Version
- Previous by thread: When to create TCustomControl's child controls?
- Next by thread: Re: When to create TCustomControl's child controls?
- Index(es):
Relevant Pages
|