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]
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