TWebView setparent TPanel

Post Reply
Natter
Posts: 1402
Joined: Mon May 14, 2007 9:49 am

TWebView setparent TPanel

Post by Natter »

Hi,

There is a control (TPanel) I need to use it as a window for a TWebView object. Making an oWebView:SetParent(oPanel). There is no error, but oWebView does not become a control.
len(oPanel:AControls) will return 0
Is this how it should be or am I wrong ?
User avatar
ertan
Posts: 61
Joined: Wed Jul 26, 2023 12:08 pm
Location: Istanbul, Turkiye

Re: TWebView setparent TPanel

Post by ertan »

Hi,

Please check this variable TPanel:New() in tpanel.prg

::nExStyle = WS_EX_CONTROLPARENT

and use oPanel:Show() after DEFINE PANEL oPanel

Best regards,
Ertan,

Natter
Posts: 1402
Joined: Mon May 14, 2007 9:49 am

Re: TWebView setparent TPanel

Post by Natter »

Actually, in the TPanel:New() method, this value is specified by default
::nExStyle = WS_EX_CONTROLPARENT

? oPanel:nExStyle returns 65536

So what ?
Horizon
Posts: 1388
Joined: Fri May 23, 2008 1:33 pm

Re: TWebView setparent TPanel

Post by Horizon »

Natter wrote: Wed Oct 01, 2025 12:57 pm Hi,

There is a control (TPanel) I need to use it as a window for a TWebView object. Making an oWebView:SetParent(oPanel). There is no error, but oWebView does not become a control.
len(oPanel:AControls) will return 0
Is this how it should be or am I wrong ?
Can you try to set oWebView:SetParent(oPanel) command in on init of panel.
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.06
User avatar
Antonio Linares
Site Admin
Posts: 44515
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: TWebView setparent TPanel

Post by Antonio Linares »

Dear Yuri,

You should do:

oWebView := TWebView2():New( oPanel )

If the panel is on a dialog box, then you have to do it from ACTIVATE DIALOG ... ON INIT ...
regards, saludos

Antonio Linares
www.fivetechsoft.com
Natter
Posts: 1402
Joined: Mon May 14, 2007 9:49 am

Re: TWebView setparent TPanel

Post by Natter »

I'm using FW 23.7, there's only the TWebView() class()

Of course, I create all the controls in the ini function :D
ACTIVATE DIALOG i ON INIT My_Ini()

function My_Ini
oPn:=TPanel():New()
oWebView:=TWybWiew():New()
oWebView:SetParent(oPn)
? len(oPn:aControls) -> 0
return
User avatar
Antonio Linares
Site Admin
Posts: 44515
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: TWebView setparent TPanel

Post by Antonio Linares »

Dear Yuri,

WebView has a special working behavior designed by Microsoft:

When we provide a parent to it, webview creates a child window of the provided window where webview places itself (in the "ghost" child).

Parent --> Ghost child --> webview

This may help you to better understand it :)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply