open a function from a link inserted in an html (oWebview) RESOLVED

Post Reply
User avatar
Silvio.Falconi
Posts: 7235
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 16 times

open a function from a link inserted in an html (oWebview) RESOLVED

Post by Silvio.Falconi »

I have a link on a oWbView made with Twebview2

Code: Select all | Expand

 <div class="quick-item" onclick="callHarbourFunction('Clienti')">
                                <img src="{IMGCLIENTI}" alt="Clienti">
                                <span>Clienti</span>
                            </div>
callHarbourFunction is on a javascritpt script

Code: Select all | Expand

<script>
                function callHarbourFunction(funcName) {
                    var data = { function: funcName };
                    var s = SendToFWH(data).then(s => {
                        alert(s.result);
                    }).catch(err => {
                        alert("Errore: " + err);
                    });
                }
            </script>

When I click on a link give me a message box with the text "array"

Image

and not open the function clienti()

How I can resolve ?
Last edited by Silvio.Falconi on Wed Mar 26, 2025 9:38 pm, edited 1 time in total.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
Posts: 7235
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 16 times

Re: open a function from a link inserted in an html (oWebview)

Post by Silvio.Falconi »

I tried with

oWebView:bOnBind := {|cJson, cCalls| ExecuteFunction(cJson, cCalls, oWebView) }

but not arrive nothing on cJson
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Ari
Posts: 250
Joined: Fri Feb 03, 2006 4:21 pm
Location: São Paulo, SP - Brazil
Been thanked: 2 times
Contact:

Re: open a function from a link inserted in an html (oWebview)

Post by Ari »

Hello

How is your function that opens the WebView?

Post an example
Thanks,
Ari

FWH 2501 - Harbour 3.2.0 - Embarcadero 7.43 - MySQL
São Paulo - SP - Brasil
www.sisrev.com.br
User avatar
Antonio Linares
Site Admin
Posts: 42716
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 93 times
Been thanked: 103 times
Contact:

Re: open a function from a link inserted in an html (oWebview)

Post by Antonio Linares »

Dear Silvio,

Please use XBrowse( data ) instead of MsgInfo( data )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Silvio.Falconi
Posts: 7235
Joined: Thu Oct 18, 2012 7:17 pm
Been thanked: 16 times

Re: open a function from a link inserted in an html (oWebview)

Post by Silvio.Falconi »

I resolved

oWebView:bOnBind := {|hData| ExecuteFunction(hData, oWebView) }

Code: Select all | Expand

 FUNCTION Extract(cString)
    LOCAL aData
    LOCAL cValue
    aData := (cString)
    cValue := aData[1]["function"]
    RETURN cValue

Code: Select all | Expand

Function ExecuteFunction(hData, oWebView)
   local  cFuncName  := Extract(hData)


   DO CASE
      CASE cFuncName == "Bacheca"
         Bacheca(oWebView)
        CASE cFuncName = "Clienti"
         Clienti()
              ENDCASE
   RETURN NIL
because the string returned by bOnBind is not a valid hash but seem as an array
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Post Reply