Help about TWebView class. reading something from website.

Re: Help about TWebView class. reading something from website.

Postby Antonio Linares » Tue Jul 05, 2022 7:52 am

Already asked to Steffen,

https://github.com/webview/webview/issues/796

Lets see what he says...
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Help about TWebView class. reading something from website.

Postby Antonio Linares » Tue Jul 05, 2022 8:43 am

The WebView2 COM API exposes ICoreWebView2::ExecuteScript and is accessible via webview::eval (C++) and webview_eval (C).


So it is our Class TWebView Method Eval() :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Help about TWebView class. reading something from website.

Postby Horizon » Tue Jul 05, 2022 1:26 pm

Antonio Linares wrote:Morning Hakan,

This is the code:
Code: Select all  Expand view
#include "FiveWin.ch"

//----------------------------------------------------------------------------//

function Main()

   local oWebView := TWebView():New(), aaa

   oWebView:bOnBind = { | cJson, nCalls | MsgInfo( cJson, nCalls ) }
   oWebView:Bind( "SendToFWH" )
   oWebView:Navigate( "https://datatables.net/examples/data_sources/js_array" )
   Sleep( 200 )
   oWebView:Eval( 'window.onload = function () { SendToFWH( document.getElementById("example").innerHTML ) }' )
   oWebView:Run()
   oWebView:Destroy()

return nil


Going to check your await command...


In order to Eval like "Window.onload", should written before oWebview.Run() command.

Here's my procedure.

1. User should login a website from main menü. (so .Run() command is must be here)
2. User press Go button in records to go in opened website.
3. User close the app. (so. .Destroy() command)

Is this procedure wrong for TWebView? any comment?

Secondly, How Can I transfer cJson variable to my app? I use public variable, but it does not worked.
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Re: Help about TWebView class. reading something from website.

Postby Antonio Linares » Tue Jul 05, 2022 2:21 pm

Hakan,

> Is this procedure wrong for TWebView? any comment?

The example I posted is working fine

> Secondly, How Can I transfer cJson variable to my app? I use public variable, but it does not worked.

Please post an example of how you are doing it
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42081
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: nageswaragunupudi and 97 guests