Deleted
Regards,
Hakan ONEMLI
Harbour & MSVC 2022 & FWH 23.06
Hakan ONEMLI
Harbour & MSVC 2022 & FWH 23.06
Deleted
Horizon wrote:Hi Antonio,
Some suggestion of TWebView class.
CLASS TOB_WebView FROM TWebView DATA nDebug DATA nEval_TimeOut INIT 15 DATA nTimeOut_Step INIT .25 DATA oWndDlgContainer DATA oMsgBar1, oMsgBar2 DATA lReadyStateControl INIT .T. ..... ...... METHOD Eval( cScript ) METHOD IsIdle() METHOD ReadData(cScript) ..... ..... ENDCLASS METHOD Eval( cScript, lSkipControl ) CLASS TOB_WebView DEFAULT lSkipControl:=.T. IF !lSkipControl ::super:Eval( cScript ) ELSEIF ::IsIdle() ::super:Eval( cScript ) ELSE MsgAlert(cScript+CRLF+"TimeOut."+CRLF+"Please ("+NTRIM(::nEval_TimeOut)+" ) increase the TimeOut_Step.","Error") ENDIF RETURN /* With Mr. Otto's suggestion. */ METHOD IsIdle() CLASS TOB_WebView LOCAL lResult:=.F., nSecond:=0, cTemp IF !::lReadyStateControl RETURN .T. ENDIF DO WHILE !lResult cTemp := ::ReadData("document.readyState") IF !HB_ISNIL(::oMsgBar1) ::oMsgBar1:SetText(cTemp) ENDIF IF cTemp = "complete" lResult := .T. EXIT ENDIF SysWait(::nTimeOut_Step) nSecond += ::nTimeOut_Step IF !HB_ISNIL(::oMsgBar2) ::oMsgBar2:SetText(NTRIM(nSecond)) ENDIF IF nSecond > ::nEval_TimeOut RETURN lResult ENDIF ENDDO RETURN lResult /* IF oWebView:IsIdle() oWebView:ReadData("document.documentURI") ENDIF */ METHOD ReadData(cScript, nTimeOut) CLASS TOB_WebView LOCAL cResult:="" DEFAULT nTimeOut:=::nTimeOut_Step cResultVar := "" ::super:Eval('SendToFWH( '+cScript+ ' )') IF !HB_ISNIL(::oMsgBar1) ::oMsgBar1:SetText(cResultVar) ENDIF SysWait(nTimeOut) cResult = MyJSONToText(cResultVar) RETURN cResult FUNCTION MyJSONToText(cText) LOCAL hDatos := {=>}, cResult:="" IF EMPTY(cText) RETURN "" ENDIF hb_JsonDecode( cText, @hDatos ) IF !EMPTY(hDatos) IF VALTYPE(hDatos)="A" IF VALTYPE(hDatos[1])="N" cResult := NTRIM(hDatos[1]) ELSEIF VALTYPE(hDatos[1])="L" cResult := hDatos[1] ELSE cResult := ALLTRIM(hDatos[1]) ENDIF ELSE IF VALTYPE(hDatos)="N" cResult := NTRIM(hDatos) ELSE cResult := ALLTRIM(hDatos) ENDIF ENDIF ENDIF RETURN cResult *------------------------------------------------------------------------------------------------------------ PROCEDURE GetDataFrom_WebView(cJson, nCalls) cResultVar := cJson RETURN *------------------------------------------------------------------------------------------------------------