All,
I'm trying to replace an ActiveX shell.explorer.2 with Webview.
With the activex, when the user closed the activex window dialog I could retrieve the document in the oWnd:Valid function.
oDoc := oActiveX:document
I have looked at the examples and previous posts and I'm unable to get this to work.
FUNCTION HPCall( cUrl )
local oDlg, oWebView
cUrl := "www.google.com"
DEFINE DIALOG oDlg SIZE 500, 600
ACTIVATE DIALOG oDlg CENTERED ;
ON INIT ( oWebView := CreateWebView(oDlg), oWebview:Navigate( cUrl ) , .T. ) ;
VALID ( ValidWebView( oWebView ), .t. )
return nil
FUNCTION CreateWebView(oDlg, cUrl)
LOCAL oWebView
oWebView := TWebView():New()
Msginfo("webview new")
oWebView:SetParent( oDlg )
oWebView:bOnBind = { | cJson, nCalls | MsgInfo( cJson, nCalls ) }
oWebView:Bind( "SendToFWH" )
RETURN oWebView
FUNCTION ValidWebView(oWebview)
LOCAL cHtml
cHtml := oWebView:Eval( "SendToFWH( document.body.innerHTML )")
Msginfo( cHtml, "cHtml") // cHtml is empty
RETURN .T.
What should I put in the OnBind code block? I don't want a message to be displayed. When the user closes the dialog I want to capture the document as I did when using Activex.
The other problem I have is when you call TWebview:New() a blank window is displayed momentarily before my dialog is displayed. I saw a reference to this in past posts however, I didn't not see any fix that addresses this. You can see this in the webview.prg and webview5.prg samples also.
Thanks,
Randal