Page 1 of 1

Webview class into Resource Dialog?

Posted: Fri Feb 17, 2023 8:31 am
by richard-service
Hi
I saw FWH\sample use TWindow way, how to use WebView into Resource Dialog

Re: Webview class into Resource Dialog?

Posted: Fri Feb 17, 2023 8:49 am
by Antonio Linares
Dear Richard,

Code: Select all | Expand

#include "FiveWin.ch"

function Main()

   local oDlg, oWebView

   DEFINE DIALOG oDlg SIZE 500, 400

   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT ( oWebView := TWebView():New(), oWebView:SetParent( oDlg ), oWebView:Navigate( "http://www.google.com" ), .T. )

return nil

Re: Webview class into Resource Dialog?

Posted: Fri Feb 17, 2023 9:30 am
by richard-service
Antonio Linares wrote:Dear Richard,

Code: Select all | Expand

#include "FiveWin.ch"

function Main()

   local oDlg, oWebView

   DEFINE DIALOG oDlg SIZE 500, 400

   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT ( oWebView := TWebView():New(), oWebView:SetParent( oDlg ), oWebView:Navigate( "http://www.google.com" ), .T. )

return nil
Dear Antonio,

Thanks for your help.

I open my Main Window and call TestWebview() function below:

Code: Select all | Expand

FUNCTION TestWebView()

LOCAL oDlg, oWebView 

      DEFINE DIALOG oDlg RESOURCE "TestWebView" 
      
      ACTIVATE DIALOG oDlg CENTER ;
               ON INIT ( oWebView := TWebView():New(), oWebView:SetParent( oDlg ), oWebView:Navigate( "http://www.google.com" ) , .T. )
                      
return nil
 
I found My Main Windows small ( I think my laptop 4K screen ), but I close Dialog, Main Window close together.

Re: Webview class into Resource Dialog?

Posted: Fri Feb 17, 2023 10:07 am
by Antonio Linares
Dear Richard,

Yes, I just confirmed what you said

No idea why this is happening, sorry

Re: Webview class into Resource Dialog?

Posted: Fri Feb 17, 2023 10:11 am
by Antonio Linares
It seems as WebView is closing the whole app

I don't know how we can avoid this behavior.

Re: Webview class into Resource Dialog?

Posted: Fri Feb 17, 2023 11:12 am
by Antonio Linares
In this example, we can check that when the dialog that holds the WebView closes, it closes the main Window but the app properly exits:

Code: Select all | Expand

#include "FiveWin.ch"

function Main()

   local oWnd 

   DEFINE WINDOW oWnd 

   ACTIVATE WINDOW oWnd ;
      ON CLICK Test()

   MsgInfo( "ok" )

return nil   

function Test()

   local oDlg, oWebView

   DEFINE DIALOG oDlg SIZE 500, 400

   ACTIVATE DIALOG oDlg CENTERED ;
      ON INIT ( oWebView := TWebView():New(), oWebView:SetParent( oDlg ), oWebView:Navigate( "http://www.google.com" ), .T. )

return nil