Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TFrame, inheritance and 'Control has no parent window'

418 views
Skip to first unread message

R. Vermeij

unread,
Nov 23, 2004, 5:32:10 AM11/23/04
to

I use Delphi 6...

I have three frames:
TframBaseConfiguration = class(TFrame)
TframBaseNamed = class(TframBaseConfiguration)
TframMachineType = class(TframBaseNamed)

After adding a label to TframBaseNamed, I now get
'Control has no parent window' when TframMachineType is
created dynamically.
TframBaseNamed has several labels, but this last label was added
after I wrote TframMachineType. When I remove this last label, all works fine. When I re-add it, I get again the error.

On the internet I found this (but it has not helped me until now):

[QUOTE]
The problem seems to occur if you have any descendants open in
the IDE while you are adding components that don't use a window
handle to the ancestor. eg. TLabel, TSpeedButton etc.
The cure is:

1/ Close all descendant frames.
2/ Add the component to the ancestor.
3/ Compile (May need to be built)
You can then reopen the desendents if you want.
[END OF QUOTE]

R. Vermeij

unread,
Nov 24, 2004, 12:30:03 AM11/24/04
to

I found the problem.
In frames the dfm file uses some sort of numbering.

object Label1: TLabel [7]
Left = 8
Top = 72
Width = 37
Height = 13
Caption = 'ID 1'
end
object Label2: TLabel [8]
Left = 8
Top = 280
Width = 50
Height = 13
Caption = ID 2'
end

After inserting a label in the ancester, the ancester also had
a TLabel [7]. So there were two of them! After correcting the
numbering manually (so there are no doubles) it all worked
fine again.

Ruud

0 new messages