Webview class into Resource Dialog?

Post Reply
User avatar
richard-service
Posts: 808
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan
Has thanked: 2 times
Contact:

Webview class into Resource Dialog?

Post by richard-service »

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
Antonio Linares
Site Admin
Posts: 42595
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 38 times
Been thanked: 86 times
Contact:

Re: Webview class into Resource Dialog?

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
richard-service
Posts: 808
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan
Has thanked: 2 times
Contact:

Re: Webview class into Resource Dialog?

Post 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.
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
Antonio Linares
Site Admin
Posts: 42595
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 38 times
Been thanked: 86 times
Contact:

Re: Webview class into Resource Dialog?

Post by Antonio Linares »

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: 42595
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 38 times
Been thanked: 86 times
Contact:

Re: Webview class into Resource Dialog?

Post by Antonio Linares »

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: 42595
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 38 times
Been thanked: 86 times
Contact:

Re: Webview class into Resource Dialog?

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply