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

ERROR: Control has '' no parent window

1,974 views
Skip to first unread message

Gustavo Morales Gámez

unread,
Apr 26, 1999, 3:00:00 AM4/26/99
to
I am trying to make a component, so i can use it on design time, but
this error appear:
"Control has '' no parent window"

The control TCarpeta works fine along, but when trying to activate from
Tfolders doesn't work.
Here is the code
hope can help me


TCarpeta=Class(TTabSheet)
Envio:TCopiarA;
Recepcion:TRecibir;
public
constructor Create(AOwner: TComponent); override;
end;

TFolders=Class(TPageControl)
AES:TCarpeta;
public
constructor Create(AOwner: TComponent); override;
end;

constructor TFolders.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
Align := alClient;
PageControl1:=Self;
AES=TCarpeta.Create(Self);
AES.Parent:=Self;
AES.PageControl := Self;
AES.Caption := 'AES';
AES.TabVisible:=True;
height:=240;
width:= 590;
end;


gmorales.vcf

Bernd Ua

unread,
Apr 27, 1999, 3:00:00 AM4/27/99
to
You're too fast for delphi.<g>

You haven't got a parent in the constructor - so you have to move every code,
that needs a windows handle to another procedure in your component.
Take a look a virtual method "Loaded". Override it in your comp and do the
offending stuff there. This routine is called after Loading of component is done
and at this time you'll have a valid parent.

HTH
Bernd

--
Bernd Ua - Software-Haus Brumund GmbH
u...@nospambrumund.de
// to reply, remove nospam from email adress :-)
// obviously this needs to be stated, too : please no unsolicited private email
unless explicitly invited

Dennis Coleman

unread,
Apr 28, 1999, 3:00:00 AM4/28/99
to Gustavo Morales Gámez
I'm not sure how your component is constructed or what it decends from but
you might try this:

constructor YourComp.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
............
end;

Gustavo Morales Gámez wrote:

> ------------------------------------------------------------------------
>
> Ing. Gustavo Morales Gámez <gmor...@aduanet.net>
> Ing.
> Aduanet, S.A. de C.V.
> Operaciones
>
> Ing. Gustavo Morales Gámez
> Ing. <gmor...@aduanet.net>
> Aduanet, S.A. de C.V.
> Operaciones
> Av. Cesar Lopez de Lara No. 3603 /107 Calle del Norte Fountain Centre Unit 11-B Fax: (87) 14-7700/(956) 718-0775
> Laredo Work: (87) 15-49-60 /(956) 718-0775
> Texas
> 78041
> U.S.A.
> Additional Information:
> Last Name Morales Gámez
> First NameGustavo Antonio
> Version 2.1


Micheus

unread,
May 1, 1999, 3:00:00 AM5/1/99
to
If you are sure that AOwner descends from a TWinControl, just add the line
bellow

constructor TFolders.Create(AOwner: TComponent);
begin
inherited Create(AOwner);

Parent := AOwner AS TWinControl; { *** ADD THIS LINE *** }
Align := alClient;
...
end;

Micheus.

Dennis Coleman escreveu na mensagem <3727588E...@nais.com>...

0 new messages