Using FW_SayText in WebView

Using FW_SayText in WebView

Postby alvaro533 » Fri Dec 29, 2023 9:35 am

Good morning,

I'm using webview in a MDICHILD

Code: Select all  Expand view

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 view
FW_SayText( oWebView:GetWindow() , "Hola: ", {400,400,20,180 },"L")


Thank you and regards,

Alvaro
alvaro533
 
Posts: 206
Joined: Sat Apr 19, 2008 10:28 pm
Location: Madrid, España

Re: Using FW_SayText in WebView

Postby Antonio Linares » Fri Dec 29, 2023 10:12 am

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.
regards, saludos

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

Re: Using FW_SayText in WebView

Postby alvaro533 » Fri Dec 29, 2023 7:13 pm

Lo probaré, gracias Antonio

Alvaro
alvaro533
 
Posts: 206
Joined: Sat Apr 19, 2008 10:28 pm
Location: Madrid, España


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 82 guests