Page 1 of 1

Using FW_SayText in WebView

Posted: Fri Dec 29, 2023 9:35 am
by alvaro533
Good morning,

I'm using webview in a MDICHILD

Code: Select all | Expand

function googlemaps(app_oWnd)

    local oWnd
    local oWebView
     
    DEFINE WINDOW oWnd MDICHILD of app_oWnd TITLE "Using a webview from an existing window" 

    oWnd:Center()
    oWebView = TWebView():New(, oWnd:hWnd )
    oWebView:Navigate( "https://www.google.es/maps/@41.9322509,-2.6522801,47269m/data=!3m1!1e3?entry=ttu" )
    oWebView:SetUserAgent( "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Mobile Safari/537.36" )

    ACTIVATE WINDOW oWnd  ;
        ON RESIZE If( nWidth != nil, oWebView:SetSize( nWidth, nHeight ), oWebView:SetSize( 800, 500 ) );
        valid(   oWebView:Destroy() , .t. )
     
return nil
 
Now the googlemaps API is not free, can I just place a text and a bitmap on the map using FW_SayText and FW_DrawImage ? I don't know what would be the first parameter (ownd) in FW_SayText. I have tried this and others and doesn´t work

Code: Select all | Expand

FW_SayText( oWebView:GetWindow() , "Hola: ", {400,400,20,180 },"L")


Thank you and regards,

Alvaro

Re: Using FW_SayText in WebView

Posted: Fri Dec 29, 2023 10:12 am
by Antonio Linares
Estimado Alvaro,

Un control WebView está totalmente controlado por el motor de Chrome y por seguridad en internet no es accesible.

Lo que si podrias intentar es usar el método InjectJavascript( cScript ) de la Clase TWebView para añadir código javascript tuyo y luego
ejecutarlo llamando al método Eval() de la Clase TWebView.

Busca "webview" en *.prg en la carpeta samples para ver los ejemplos.

Re: Using FW_SayText in WebView

Posted: Fri Dec 29, 2023 7:13 pm
by alvaro533
Lo probaré, gracias Antonio

Alvaro