Webview class into Resource Dialog?

Webview class into Resource Dialog?

Postby richard-service » Fri Feb 17, 2023 8:31 am

Hi
I saw FWH\sample use TWindow way, how to use WebView into Resource Dialog
Best Regards,

Richard

Harbour 3.2.0dev (r2402101027) => Borland C++ v7.7 32bit
MySQL v8.0 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
User avatar
richard-service
 
Posts: 804
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan

Re: Webview class into Resource Dialog?

Postby Antonio Linares » Fri Feb 17, 2023 8:49 am

Dear Richard,

Code: Select all  Expand view  RUN
#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
regards, saludos

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

Re: Webview class into Resource Dialog?

Postby richard-service » Fri Feb 17, 2023 9:30 am

Antonio Linares wrote:Dear Richard,

Code: Select all  Expand view  RUN
#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 view  RUN

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.
Best Regards,

Richard

Harbour 3.2.0dev (r2402101027) => Borland C++ v7.7 32bit
MySQL v8.0 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
User avatar
richard-service
 
Posts: 804
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan

Re: Webview class into Resource Dialog?

Postby Antonio Linares » Fri Feb 17, 2023 10:07 am

Dear Richard,

Yes, I just confirmed what you said

No idea why this is happening, sorry
regards, saludos

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

Re: Webview class into Resource Dialog?

Postby Antonio Linares » Fri Feb 17, 2023 10:11 am

It seems as WebView is closing the whole app

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

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

Re: Webview class into Resource Dialog?

Postby Antonio Linares » Fri Feb 17, 2023 11:12 am

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 view  RUN
#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
regards, saludos

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 46 guests

cron