Creating tabbed browser? lazarus / 34-Windows ---------------------------------------------------------------------- Timewarp · 2012-07-14 07:35 I have pagecontrol and create tabs like this: Code: [Select]NewTab:=TTabSheet.Create(PageControl1); with NewTab do   begin    PageControl:=PageControl1;    Parent:=PageControl1;    Visible:=true;   end; activexcontainer1:=Tactivexcontainer.Create(NewTab); Browser:=TEvsWebBrowser.Create(NewTab); activexcontainer1.ComServer:=Browser.ComServer; activexcontainer1.Align:=alClient; activexcontainer1.Active:=true; .. In Delphi I can navigate different browsers like this: TWebbrowser(Pagecontrol1.activepage.controls[0]).navigate(... But I have problems getting TEvsWebBrowser this way? These don't work: TActivexcontainer(Pagecontrol1.activepage.controls[0]).comserver.navig ate(.. TEvsWebBrowser(Pagecontrol1.activepage.controls[0]).comserver.navigate (.. I can only do this: TActivexcontainer(Pagecontrol1.activepage.controls [0]).vobject.navigate(... But that is IDispatch one. Is there any way to get TEvsWebBrowser from TActivexcontainer? ---------------------------------------------------------------------- ludob · 2012-07-14 11:48 Code: [Select]Is there any way to get TEvsWebBrowser from TActivexcontainer?Yes, but a little more convoluted than your Delphi example: Code: [Select](TActiveXContainer(Pagecontrol1.activepage.controls[0]). ComServer as IWebBrowser2).Navigate(...) So the steps are: -cast controls[0] to TActiveXContainer -get ComServer which is just a IDispatch -get IWebBrowser2 from ComServer. Navigate is a method of IWebBrowser. So  'as IWebBrowser' would work also. Delphi creates class stubs such as TWebbrowser that mask the interface so that you can use a simpler typecast from a plain control to a TWebbrowser. The fpc type library importer does not create these stubs. In cases like this a little bit of footwork is needed to get to the same result. ---------------------------------------------------------------------- Timewarp · 2012-07-18 14:27 That does it, thanks! I also have cases, where I need Tactivexcontainer from TEvsWebbrowser? For example procedure dosomething(WB: TActivexContainer); Documentcomplete has asender and pDisp. I would like to do: dosomething(TActiveXcontainer(asender)); but it crashes. What would be correct way to do that? ---------------------------------------------------------------------- Timewarp · 2012-08-06 07:01 I did solve problem like this Code: [Select]Browser:=TEvsWebBrowser.Create(ActivexContainer1); .. .. dosomething(TEvsWebbrowser(Asender).owner as TActivexContainer);