Help about TWebView class. reading something from website.

User avatar
Antonio Linares
Site Admin
Posts: 42597
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 40 times
Been thanked: 86 times
Contact:

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

Post by Antonio Linares »

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: 42597
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 40 times
Been thanked: 86 times
Contact:

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

Post by Antonio Linares »

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
Horizon
Posts: 1327
Joined: Fri May 23, 2008 1:33 pm
Has thanked: 5 times

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

Post by Horizon »

Antonio Linares wrote:Morning Hakan,

This is the code:

Code: Select all | Expand

#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
User avatar
Antonio Linares
Site Admin
Posts: 42597
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 40 times
Been thanked: 86 times
Contact:

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

Post by Antonio Linares »

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
Post Reply