Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Control ' has no parent window

Status
Not open for further replies.

djjd47130

Programmer
Nov 1, 2010
480
US
I have been writing custom components for quite some time now. I've also converted some things to ActiveX. What I'm working on now I've already converted to an ActiveX control, but now for some reason, when I try to build the ActiveX control (based on my existing control), I get this error "Control ' has no parent window".

I am using Delphi7 and its option to create an ActiveX control based on any TWinControl inheritance. In this case, I'm basing my control off of a TCustomControl. I suspect my problem is coming from within this control's constructor...

Code:
constructor TJDChatClientWrap.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  Parent:= TWinControl(AOwner);
  fCli:= TJDChatClient.Create(Self);
  fCli.OnLog:= CliLog;
  fCli.OnLoginResponse:= CliLoginResult;
  Font.Color:= clSkyBlue;
  Font.Size:= 10;
  Font.Style:= [fsBold];  
  Paint;
end;

The control wraps another existing non-visual component (TJDChatClient: TComponent). Like I said, it was working fine the first time I made it into an ActiveX control, but this second time is failing with this error.


JD Solutions
 
try

Code:
ParentWindow := TWinControl(AOwner);

/Daddy

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
Those types don't match... Do you mean...
Code:
ParentWindow:= TWinControl(AOwner).Handle;
That doesn't even work either though...

JD Solutions
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top