Page 3 of 4
Re: TWebView:Destroy method does not close the window.
Posted: Fri Aug 05, 2022 5:31 am
by Antonio Linares
Dear Hakan,
If that example is fine for you, ok. To me, the MDI environment is the right one to have multiple webviews running at the same time
Estimado César,
Si estás interesado en probar los últimos cambio, te envío las librerias. De momento solo se las he enviado a Hakan por que él está
muy activo probando webview

Re: TWebView:Destroy method does not close the window.
Posted: Fri Aug 05, 2022 12:50 pm
by cmsoft
Si no es molestia, me gustaría probarlas...
Muchas gracias Antonio
Re: TWebView:Destroy method does not close the window.
Posted: Fri Aug 05, 2022 12:51 pm
by cmsoft
Antonio Linares wrote:Dear Hakan,
If that example is fine for you, ok. To me, the MDI environment is the right one to have multiple webviews running at the same time
Igual para mi!
Re: TWebView:Destroy method does not close the window.
Posted: Fri Aug 05, 2022 1:12 pm
by Horizon
Hi Antonio,
I have two version of TWebView examples that shows both "document.readyState"
First one is original FWH TWebView class with dialog container with your last sended fwh libs.
Code: Select all | Expand
#include "FiveWin.ch"
function Main()
local oWnd, oBar
DEFINE WINDOW oWnd
DEFINE BUTTONBAR oBar 3D OF oWnd SIZE 60, 60
DEFINE BUTTON PROMPT "Open" OF oBar ACTION (Open_Google( oWnd ))
ACTIVATE WINDOW oWnd
return nil
function Open_Google( oWnd )
LOCAL cHtml:="https://forums.fivetechsupport.com/ucp.php?mode=login&sid=12267e643672303281cdf64289c6875d"
local oWndChild, oWebView
DEFINE WINDOW oWndChild TITLE "My Test FW Window_"+TIME() ;
FROM 100, 100 TO 768, 1024 PIXEL
oWndChild:bInit := <||
oWebView := TWebView():New(,oWndChild:hWnd)
oWebView:SetSize(oWndChild:nWidth, oWndChild:nHeight,0)
oWebView:bOnBind = { | cJson, nCalls | GetDataFrom_WebView( cJson, nCalls ) }
oWebView:Bind( "SendToFWH" )
oWebView:Navigate(cHtml)
// oWebView:Run() // We dont need when oWndChild
Return Nil
>
oWndChild:bValid := <||
oWebView:Destroy()
Return .T.
>
ACTIVATE WINDOW oWndChild
? "I am here - Outside"
cMyParam := ""
cText := 'document.readyState'
oWebView:Eval("SendToFWH( "+cText+")")
SysWait(2)
? cMyParam, "cMyParam - readyState'"
return nil
PROCEDURE GetDataFrom_WebView(cJson, nCalls)
cMyParam := cJson
RETURN
Second one uses TOB_WebView class derived from original FWH TWebView class. It has only one method. (new method). It is exactly does same thing.
Code: Select all | Expand
#include "FiveWin.ch"
function Main()
local oWnd, oBar
DEFINE WINDOW oWnd
DEFINE BUTTONBAR oBar 3D OF oWnd SIZE 60, 60
DEFINE BUTTON PROMPT "Open" OF oBar ACTION (Open_Google( oWnd ))
ACTIVATE WINDOW oWnd
return nil
function Open_Google( oWnd )
LOCAL cHtml:="https://forums.fivetechsupport.com/ucp.php?mode=login&sid=12267e643672303281cdf64289c6875d"
local oWndChild, oWebView
DEFINE WINDOW oWndChild TITLE "My Test FW Window_"+TIME() ;
FROM 100, 100 TO 768, 1024 PIXEL
oWndChild:bInit := <||
oWebView := TOB_WebView():New(oWndChild)
oWebView:bOnBind = { | cJson, nCalls | GetDataFrom_WebView( cJson, nCalls ) }
oWebView:Bind( "SendToFWH" )
oWebView:Navigate(cHtml)
// oWebView:Run() // We dont need when oWndChild
Return Nil
>
oWndChild:bValid := <||
oWebView:Destroy()
Return .T.
>
ACTIVATE WINDOW oWndChild
? "I am here - Outside"
cMyParam := ""
cText := 'document.readyState'
oWebView:Eval("SendToFWH( "+cText+")")
SysWait(2)
? cMyParam, "cMyParam - readyState'"
return nil
PROCEDURE GetDataFrom_WebView(cJson, nCalls)
cMyParam := cJson
RETURN
*------------------------------------------------------------------------------------------
CLASS TOB_WebView FROM TWebView
Data oWndDlgContainer
DATA lStartRun INIT .F.
METHOD New(oWndDlgContainer) Constructor
ENDCLASS
METHOD New(oWndDlgContainer) CLASS TOB_WebView
Local lc_lLoopReSize := .F.
::oWndDlgContainer := oWndDlgContainer
If !Hb_IsNil(::oWndDlgContainer)
::hWebView := WEBVIEW_CREATE(,::oWndDlgContainer:hWnd)
::oWndDlgContainer:bResized := <||
If !lc_lLoopReSize
lc_lLoopReSize := .T.
hb_idleSleep(.001)
::SetSize(::oWndDlgContainer:nWidth,;
::oWndDlgContainer:nHeight,0)
lc_lLoopReSize := .F.
EndIf
Return Nil
>
Else
::hWebView := WEBVIEW_CREATE()
EndIf
RETURN Self
Problem is that first example show ["complete"]. This is exactly the expected data.
But second one there is not any read data even both example runs original Eval Method from FWH TWebView class, because there is not any derived Eval function. I gues
Can you help me please?
Re: TWebView:Destroy method does not close the window.
Posted: Fri Aug 05, 2022 2:07 pm
by Giovany Vecchi
Horizon wrote:Second one uses TOB_WebView class derived from original FWH TWebView class. It has only one method. (new method). It is exactly does same thing.
Code: Select all | Expand
#include "FiveWin.ch"
function Main()
local oWnd, oBar
DEFINE WINDOW oWnd
DEFINE BUTTONBAR oBar 3D OF oWnd SIZE 60, 60
DEFINE BUTTON PROMPT "Open" OF oBar ACTION (Open_Google( oWnd ))
ACTIVATE WINDOW oWnd
return nil
function Open_Google( oWnd )
LOCAL cHtml:="https://forums.fivetechsupport.com/ucp.php?mode=login&sid=12267e643672303281cdf64289c6875d"
local oWndChild, oWebView
DEFINE WINDOW oWndChild TITLE "My Test FW Window_"+TIME() ;
FROM 100, 100 TO 768, 1024 PIXEL
oWndChild:bInit := <||
oWebView := TOB_WebView():New(oWndChild)
oWebView:bOnBind = { | cJson, nCalls | GetDataFrom_WebView( cJson, nCalls ) }
oWebView:Bind( "SendToFWH" )
oWebView:Navigate(cHtml)
// oWebView:Run() // We dont need when oWndChild
Return Nil
>
oWndChild:bValid := <||
oWebView:Destroy()
Return .T.
>
ACTIVATE WINDOW oWndChild
? "I am here - Outside"
cMyParam := ""
cText := 'document.readyState'
oWebView:Eval("SendToFWH( "+cText+")")
SysWait(2)
? cMyParam, "cMyParam - readyState'"
return nil
PROCEDURE GetDataFrom_WebView(cJson, nCalls)
cMyParam := cJson
RETURN
*------------------------------------------------------------------------------------------
CLASS TOB_WebView FROM TWebView
Data oWndDlgContainer
DATA lStartRun INIT .F.
METHOD New(oWndDlgContainer) Constructor
ENDCLASS
METHOD New(oWndDlgContainer) CLASS TOB_WebView
Local lc_lLoopReSize := .F.
::oWndDlgContainer := oWndDlgContainer
If !Hb_IsNil(::oWndDlgContainer)
::hWebView := WEBVIEW_CREATE(,::oWndDlgContainer:hWnd)
::oWndDlgContainer:bResized := <||
If !lc_lLoopReSize
lc_lLoopReSize := .T.
hb_idleSleep(.001)
::SetSize(::oWndDlgContainer:nWidth,;
::oWndDlgContainer:nHeight,0)
lc_lLoopReSize := .F.
EndIf
Return Nil
>
Else
::hWebView := WEBVIEW_CREATE()
EndIf
RETURN Self
Problem is that first example show ["complete"]. This is exactly the expected data.
But second one there is not any read data even both example runs original Eval Method from FWH TWebView class, because there is not any derived Eval function. I gues
Can you help me please?
Hello, this code is from a class I was building. I posted it here just so it could be analyzed. The correct thing is you use the class that Linares is building. In the future I will also use the native fivewin class.
Here are the sources:
https://app.box.com/s/dklixp7uu9ni5sz8llqt3nq1zqp13kyb
Re: TWebView:Destroy method does not close the window.
Posted: Fri Aug 05, 2022 2:11 pm
by Horizon
Giovany Vecchi wrote:Horizon wrote:Second one uses TOB_WebView class derived from original FWH TWebView class. It has only one method. (new method). It is exactly does same thing.
Code: Select all | Expand
#include "FiveWin.ch"
function Main()
local oWnd, oBar
DEFINE WINDOW oWnd
DEFINE BUTTONBAR oBar 3D OF oWnd SIZE 60, 60
DEFINE BUTTON PROMPT "Open" OF oBar ACTION (Open_Google( oWnd ))
ACTIVATE WINDOW oWnd
return nil
function Open_Google( oWnd )
LOCAL cHtml:="https://forums.fivetechsupport.com/ucp.php?mode=login&sid=12267e643672303281cdf64289c6875d"
local oWndChild, oWebView
DEFINE WINDOW oWndChild TITLE "My Test FW Window_"+TIME() ;
FROM 100, 100 TO 768, 1024 PIXEL
oWndChild:bInit := <||
oWebView := TOB_WebView():New(oWndChild)
oWebView:bOnBind = { | cJson, nCalls | GetDataFrom_WebView( cJson, nCalls ) }
oWebView:Bind( "SendToFWH" )
oWebView:Navigate(cHtml)
// oWebView:Run() // We dont need when oWndChild
Return Nil
>
oWndChild:bValid := <||
oWebView:Destroy()
Return .T.
>
ACTIVATE WINDOW oWndChild
? "I am here - Outside"
cMyParam := ""
cText := 'document.readyState'
oWebView:Eval("SendToFWH( "+cText+")")
SysWait(2)
? cMyParam, "cMyParam - readyState'"
return nil
PROCEDURE GetDataFrom_WebView(cJson, nCalls)
cMyParam := cJson
RETURN
*------------------------------------------------------------------------------------------
CLASS TOB_WebView FROM TWebView
Data oWndDlgContainer
DATA lStartRun INIT .F.
METHOD New(oWndDlgContainer) Constructor
ENDCLASS
METHOD New(oWndDlgContainer) CLASS TOB_WebView
Local lc_lLoopReSize := .F.
::oWndDlgContainer := oWndDlgContainer
If !Hb_IsNil(::oWndDlgContainer)
::hWebView := WEBVIEW_CREATE(,::oWndDlgContainer:hWnd)
::oWndDlgContainer:bResized := <||
If !lc_lLoopReSize
lc_lLoopReSize := .T.
hb_idleSleep(.001)
::SetSize(::oWndDlgContainer:nWidth,;
::oWndDlgContainer:nHeight,0)
lc_lLoopReSize := .F.
EndIf
Return Nil
>
Else
::hWebView := WEBVIEW_CREATE()
EndIf
RETURN Self
Problem is that first example show ["complete"]. This is exactly the expected data.
But second one there is not any read data even both example runs original Eval Method from FWH TWebView class, because there is not any derived Eval function. I gues
Can you help me please?
Hello, this code is from a class I was building. I posted it here just so it could be analyzed. The correct thing is you use the class that Linares is building. In the future I will also use the native fivewin class.
Here are the sources:
https://app.box.com/s/dklixp7uu9ni5sz8llqt3nq1zqp13kyb
Yes Giavony, you are right. Much obliged. I just want to give this example to compare. What is different?
Re: TWebView:Destroy method does not close the window.
Posted: Fri Aug 05, 2022 3:14 pm
by Giovany Vecchi
Horizon wrote:Yes Giavony, you are right. Much obliged. I just want to give this example to compare. What is different?
I don't know what the difference is because I don't have the 2206 version of fivewin. I'm using version 1909.
Re: TWebView:Destroy method does not close the window.
Posted: Fri Aug 05, 2022 8:19 pm
by Horizon
Hi Antonio,
Can you help me please?
Re: TWebView:Destroy method does not close the window.
Posted: Sat Aug 06, 2022 9:53 am
by Horizon
Hi Antonio,
I found my mistake.
I used the WebView_Create function in the New method of my own class. So my class does not added to aWebView array that is used for to run Bind function.
I have changed CREATE_WEBVIEW() functions to ::Super:New(....). Sorry for making you unnecessarily busy.
This is full working my second example (Created with the idea taken from Giovany's examples.)
Code: Select all | Expand
#include "FiveWin.ch"
function Main()
local oWnd, oBar
DEFINE WINDOW oWnd
DEFINE BUTTONBAR oBar 3D OF oWnd SIZE 60, 60
DEFINE BUTTON PROMPT "Open" OF oBar ACTION (Open_Google( oWnd ))
ACTIVATE WINDOW oWnd
return nil
function Open_Google( oWnd )
LOCAL cHtml:="https://forums.fivetechsupport.com/ucp.php?mode=login&sid=12267e643672303281cdf64289c6875d"
local oWndChild, oWebView
DEFINE WINDOW oWndChild TITLE "My Test FW Window_"+TIME() ;
FROM 100, 100 TO 768, 1024 PIXEL
oWndChild:bInit := <||
// oWebView := TWebView():New(,oWndChild:hWnd)
// oWebView:SetSize(oWndChild:nWidth, oWndChild:nHeight,0)
oWebView := TOB_WebView():New(oWndChild)
oWebView:bOnBind = { | cJson, nCalls | GetDataFrom_WebView( cJson, nCalls ) }
oWebView:Bind( "SendToFWH" )
oWebView:Navigate(cHtml)
// oWebView:Run() // We dont need when oWndChild
Return Nil
>
oWndChild:bValid := <||
oWebView:Destroy()
Return .T.
>
ACTIVATE WINDOW oWndChild
? "I am here - Outside"
cMyParam := ""
cText := 'document.readyState'
oWebView:Eval("SendToFWH( "+cText+")")
SysWait(2)
? cMyParam, "cMyParam - readyState'"
return nil
PROCEDURE GetDataFrom_WebView(cJson, nCalls)
cMyParam := cJson
RETURN
*------------------------------------------------------------------------------------------
CLASS TOB_WebView FROM TWebView
Data oWndDlgContainer
DATA lStartRun INIT .F.
METHOD New(oWndDlgContainer) Constructor
ENDCLASS
METHOD New(oWndDlgContainer) CLASS TOB_WebView
Local lc_lLoopReSize := .F.
::oWndDlgContainer := oWndDlgContainer
If !Hb_IsNil(::oWndDlgContainer)
// ::hWebView := WEBVIEW_CREATE(,::oWndDlgContainer:hWnd)
::Super:New(,::oWndDlgContainer:hWnd) // Changed
::oWndDlgContainer:bResized := <||
If !lc_lLoopReSize
lc_lLoopReSize := .T.
hb_idleSleep(.001)
::SetSize(::oWndDlgContainer:nWidth,;
::oWndDlgContainer:nHeight,0)
lc_lLoopReSize := .F.
EndIf
Return Nil
>
Else
::Super:New() // Changed
// ::hWebView := WEBVIEW_CREATE()
EndIf
RETURN Self
Re: TWebView:Destroy method does not close the window.
Posted: Sat Aug 06, 2022 4:50 pm
by Antonio Linares
cmsoft wrote:Si no es molestia, me gustaría probarlas...
Muchas gracias Antonio
Estimado César,
Para que compilador de C las necesitas ?
saludos
Re: TWebView:Destroy method does not close the window.
Posted: Sat Aug 06, 2022 7:32 pm
by cmsoft
BCC7
Re: TWebView:Destroy method does not close the window.
Posted: Sun Aug 07, 2022 5:31 am
by Antonio Linares
Enviadas!

Re: TWebView:Destroy method does not close the window.
Posted: Sun Aug 07, 2022 6:57 am
by Otto
Dear Antonio,
What exactly do I need to download to test the TWebview examples out of the box.
Does it also work with xHarbour?
Best regards,
Otto
Re: TWebView:Destroy method does not close the window.
Posted: Sun Aug 07, 2022 9:52 am
by Antonio Linares
Dear Otto,
> What exactly do I need to download to test the TWebview examples out of the box.
Simply install FWH 22.06 then go to samples folder and do:
buildh webview
buildh webviewuni
> Does it also work with xHarbour?
Yes, 100% fully supported

Re: TWebView:Destroy method does not close the window.
Posted: Sun Aug 07, 2022 10:00 am
by Otto
Dear Antonio,
thank you so much and have a nice Sunday.
Best regards,
Otto