I found you have to cast the Twebbrowser thru a
tcontrol to set the parent here is an example that I got working.
procedure TForm1.Button1Click(Sender: TObject);
var
Page : TTabSheet;
web : TMyweb;
begin
Page := TTabSheet.Create(Self);
try
Page.PageControl := PageControl;
web := TMyweb.Create(Page);
TControl(web).Parent := Page;
web.Align := alClient;
PageControl.ActivePage := Page;
web.SetFocus;
except
on exception do Page.Free;
end;
end;
I hope this helps you out.
Jim Ernsberger
CodeMonkey for GDSoft
*************************************************************
Hi Richard,
the following code is working fine for me (don´t forget
to navigate to a site, cause you won´t see that it´s a
browser if you don´t):
procedure TForm1.Button1Click(Sender: TObject);
var
i : integer;
begin
with PageControl1 do
begin
for i := 0 to 2 do
with TTabSheet.Create(self) do
begin
PageControl := PageControl1;
Pages[i].TabVisible := true;
Caption := 'Page: ' + IntToStr(Pages[i].PageIndex);
with TWebBrowser.Create(self) do
begin
ParentWindow := pages[i].Handle;
enabled := true;
visible := true;
align := alclient;
// **********************************************
// you won´t see that it´s a browser if you leave
// out the following line:
Navigate('http://www.borland.com');
// **********************************************
end;
end;
end;
end;
******************************************************************
> There are two ways i know of:
>
> 1-
> NewWeb:=TWebBrowser.Create(NewTab);
> TWinControl(NewWeb).parent := Self; {or whatever!}
> NewWeb.Visible := True;
> NewWeb.BringToFront;
Because i need a the NewTab var-reference in the TWebBrowser.Create call
(AOwner).