Board index » delphi » Checking Design time parent of controls

Checking Design time parent of controls

Hi all,

I created a control that can only be added into a certain Parentcontrol.
How can i check that  control has been dropped on that certain Parentcontrol
at design time?
I guess that i should check that in Create procedure, but thats all i guess.

Thanx, joe

 

Re:Checking Design time parent of controls


Surely for most controls the Create method requires an Owner, which is
not quite the same as a Parent

I assume your control could be owned by anything.

It is the Parent property that you are after ... I think

Of course there is also the SetParent API ...

On Wed, 13 Nov 2002 13:42:25 +0100, "Joe" <J...@IntelcomNoSpam.si>
wrote:

Quote
>Hi all,

>I created a control that can only be added into a certain Parentcontrol.
>How can i check that  control has been dropped on that certain Parentcontrol
>at design time?
>I guess that i should check that in Create procedure, but thats all i guess.

>Thanx, joe

Re:Checking Design time parent of controls


Quote
"Joe" <J...@IntelcomNoSpam.si> wrote in message
> I created a control that can only be added into a certain Parentcontrol.
> How can i check that  control has been dropped on that certain
Parentcontrol
> at design time?
> I guess that i should check that in Create procedure, but thats all i

guess.

Parent is not assigned during the create call, it is always assigned
afterwards, i.e. once the component has be completely created. You may wish
to adopt the strategy used by various VCL controls (e.g. tPageControl and
its tTabSheet children) to resolve this issue.

Re:Checking Design time parent of controls


On Wed, 13 Nov 2002 13:42:25 +0100, "Joe" <J...@IntelcomNoSpam.si>
wrote:

Quote
>Hi all,

>I created a control that can only be added into a certain Parentcontrol.
>How can i check that  control has been dropped on that certain Parentcontrol
>at design time?
>I guess that i should check that in Create procedure, but thats all i guess.

Override SetParent and raise an exception if you don't like the class
of the supplied object.

--
jc

Other Threads