Board index » delphi » control '' has no parent window

control '' has no parent window

I have several components that I created in Delphi 6 by inheriting
standard controls such as TComboBox.  I loaded those into Delphi 7 and
compiled them.  When I try to drop them on the form at design time, some
of them (like the TComboBox descendant) give the error message "control
'' has no parent window" and will not drop on the form.

Can someone please inform me as to what I need to do to fix this.

Thanks.

 

Re:control '' has no parent window


If you did a search, you'd find thousands of messages with exactly the same
subject and replies with solution.
In short, don't touch Items in constructor, but somewhere later, like Loaded
or CreateWnd.

--
Robert Cerny

Quote
"Richard Gilbert" <rag...@bellsouth.net> wrote in message

news:3E81DE28.5080006@bellsouth.net...
Quote
> I have several components that I created in Delphi 6 by inheriting
> standard controls such as TComboBox.  I loaded those into Delphi 7 and
> compiled them.  When I try to drop them on the form at design time, some
> of them (like the TComboBox descendant) give the error message "control
> '' has no parent window" and will not drop on the form.

> Can someone please inform me as to what I need to do to fix this.

> Thanks.

Re:control '' has no parent window


Quote
Richard Gilbert wrote:
> I have several components that I created in Delphi 6 by inheriting
> standard controls such as TComboBox.  I loaded those into Delphi 7
> and compiled them.  When I try to drop them on the form at design
> time, some of them (like the TComboBox descendant) give the error
> message "control '' has no parent window" and will not drop on the
> form.

Usually this is because some code in the constructor is causing the
control to create its window handle. At that time the parent hasn't
been assigned so the handle cannot be created and you get that error.

Suggestion:
Create an instance of your control by code (not by dropping it on the
form) and single step the constructor to find the line that causes a
CreateWnd. Fix the error by moving the offending line to CreateWnd
instead of teh constructor.

Other Threads