FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour IE
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM

Re: IE

Posted: Sat Jun 04, 2022 10:32 AM

Antonio, excuse me, I sent you an html file by email.

hb_DynCall( { "webview_navigate", pLib, ;
hb_bitOr( HB_DYN_CTYPE_VOID, hb_SysCallConv() ),;
HB_DYN_CTYPE_VOID_PTR, HB_DYN_CTYPE_CHAR_PTR },;
hWebView, "data:text/html,"+CRLF+filestr("my.html"))

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: IE

Posted: Sat Jun 04, 2022 11:21 PM

Dear Yuri,

If you upload your HTML file to your hosting server and then use webview to navigate to it, it works fine. I just tested it.

But if we try to load it reading the file, then it crashes. Not sure why. We have noticed that with other HTML files too and still we
are wondering why.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: IE

Posted: Sat Jun 04, 2022 11:23 PM
In webview docs we find this:

// Navigates webview to the given URL. URL may be a properly encoded data URI.
// Examples:
// webview_navigate(w, "https://github.com/webview/webview");
// webview_navigate(w, "data:text/html,%3Ch1%3EHello%3C%2Fh1%3E");
// webview_navigate(w, "data:text/html;base64,PGgxPkhlbGxvPC9oMT4=");


Please notice that the HTML contents seems to be encoded. Maybe thats required.
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: IE

Posted: Sat Jun 04, 2022 11:34 PM

Solved :-)

oWebView:Navigate( "data:text/html;base64," + hb_base64Encode( hb_memoRead( "my.html" ) ) )

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM

Re: IE

Posted: Sun Jun 05, 2022 08:28 AM
Antonio, thank you, the html file is loading normally. Only in webview, map rendering is much slower than in IE.

I tried to embed a webview object in a window. According to the documentation, the second webview_create parameter should be replaced with the window handle. However, it didn't work :-)

Code (fw): Select all Collapse
function Main()
private pLib := hb_LibLoad( "webview.dll" )
private oWnd

   DEFINE DIALOG oWnd TITLE "FWH desktop app" SIZE 1000, 600

   ACTIVATE DIALOG oWnd  ON INIT CreateWebView() CENTER

   hb_LibFree( pLib )
return NIL

function CreateWebView
local hWebView

   hWebView := hb_DynCall( { "webview_create", pLib, ;
                 hb_bitOr( HB_DYN_CTYPE_VOID_PTR, hb_SysCallConv() ), ;
                 HB_DYN_CTYPE_VOID_PTR, hb_SysLong(), HB_DYN_CTYPE_VOID_PTR }, ;
                 oWnd:hWnd, 0)

   hb_DynCall( { "webview_navigate", pLib, ;
                 hb_bitOr( HB_DYN_CTYPE_VOID, hb_SysCallConv() ),;
                 HB_DYN_CTYPE_VOID_PTR, HB_DYN_CTYPE_CHAR_PTR },;
                 hWebView, "data:text/html;base64,"+ ;
                 hb_base64Encode(hb_memoread("my.html"))) 

   hb_DynCall( { "webview_run", pLib, ;
                 hb_bitOr( HB_DYN_CTYPE_VOID, hb_SysCallConv() ), ;
                 HB_DYN_CTYPE_VOID, HB_DYN_CTYPE_VOID_PTR }, hWebView )
return nil
Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: IE

Posted: Mon Jun 06, 2022 06:21 AM

You have to supply 0, 0 to WebView_Create(). It does not work using params there

But you can make it child of any other window using SetParent( webview_get_window( hWebView ), hWndParent )

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM

Re: IE

Posted: Mon Jun 06, 2022 11:33 AM

Harbour doesn't understand this syntax:
webview_get_window( hWebView )

I tried to read the window handle, but I get empty.

hWebView := hb_DynCall( { "webview_create", pLib, ;
hb_bitOr( HB_DYN_CTYPE_VOID_PTR, hb_SysCallConv() ), ;
HB_DYN_CTYPE_VOID_PTR, hb_SysLong(), HB_DYN_CTYPE_VOID_PTR }, 0, 0)

hWb:=hb_DynCall( { "webview_get_window", pLib, ;
hb_bitOr( HB_DYN_CTYPE_VOID, hb_SysCallConv() ), ;
HB_DYN_CTYPE_VOID, HB_DYN_CTYPE_VOID_PTR }, hWebView )

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: IE

Posted: Mon Jun 06, 2022 06:46 PM

Dear Yuri,

You need the new Class TWebView. It properly works with Borland, Microsoft, MinGW and xHarbour too

Its going to be available in a few days with the new FWH 22.06 version

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 1392
Joined: Mon May 14, 2007 09:49 AM

Re: IE

Posted: Tue Jun 07, 2022 03:55 AM

Is it possible to install webview 2 runtime under Linux ?

Posts: 44162
Joined: Thu Oct 06, 2005 05:47 PM

Re: IE

Posted: Tue Jun 07, 2022 05:16 AM
From https://github.com/webview/webview:

It uses Cocoa/WebKit on macOS, gtk-webkit2 on Linux and Edge on Windows 10.


So it seems as it also works on Linux. I haven't tried it on Linux yet
regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion