HTML code in a TPanel class

HTML code in a TPanel class

Postby Otto » Sat Jan 20, 2024 4:32 pm

Hello friends,

Is it possible to display HTML code in a TPanel class?

I need it to display announcements or deadlines with the ability to embed links to call for applications.

I have done it, but it only runs on an HTML page, instead I would like to insert it into a TPanel because the TPanel is in the main window and is visible to all users on the network.


So far, I have only taken a window as a control to embed it.

I have looked at the TWebView class, and it is that all controls can use hWndParent.

The WebView2 control can run inside a window control like a Tpanel in a Windows application.

METHOD New(nDebug, hWndParent)

Here is a very basic test:

Best regards,

Otto


Code: Select all  Expand view


// Testing FiveWin splitter controls

#include "FiveWin.ch"
#include "Splitter.ch"

static oWnd
static oVSplitL, oHSplitC, oVSplitR

//----------------------------------------------------------------------------//

function Main()

   local oPanel1, oPanel2, oPanel3, oPanel4
   local nLeftPos   := 200
   local nRightPos  := ScreenWidth() - 200
   local nMiddlePos := ScreenHeight() - 200

   DEFINE WINDOW oWnd FROM 1, 1 TO 400, 600 PIXEL ;
      TITLE "Splitters H layout"

   oPanel1 = TPanel():New( 0, 0, oWnd:nHeight, nLeftPos - 5, oWnd )
   oPanel2 = TPanel():New( 0, nLeftPos + 1, nMiddlePos - 1, nRightPos - 1, oWnd )
   oPanel3 = TPanel():New( nMiddlePos + 4, nLeftPos + 1, oWnd:nHeight, nRightPos - 1, oWnd )
   oPanel4 = TPanel():New( 0, nRightPos + 5, oWnd:nHeight, oWnd:nWidth, oWnd )

   oPanel1:SetColor( "W/R" )
   oPanel2:SetColor( "W/G" )
   oPanel3:SetColor( "W/B" )
   oPanel4:SetColor( "W/BG" )
   
   oPanel1:bLClicked = { || MsgInfo( "Panel1" ) }
   oPanel2:bLClicked = { || MsgInfo( "Panel2" ) }
   oPanel3:bLClicked = { || MsgInfo( "Panel3" ) }
   oPanel4:bLClicked = { || MsgInfo( "Panel4" ) }

   @ nMiddlePos, nLeftPos + 1 SPLITTER oHSplitC ;
              HORIZONTAL ;
              PREVIOUS CONTROLS oVSplitL, oPanel2 ;
              HINDS CONTROLS oPanel3, oVSplitR ;
              TOP MARGIN 80 ;
              BOTTOM MARGIN 80 ;
              SIZE nRightPos - nLeftPos - 2, 4 PIXEL ;
              OF oWnd ;
              STYLE

   @  0, nLeftPos - 5 SPLITTER oVSplitL ;
              VERTICAL ;
              PREVIOUS CONTROLS oPanel1 ;
              HINDS CONTROLS oPanel2, oHSplitC, oPanel3 ;
              LEFT MARGIN 80 ;
              RIGHT MARGIN 80 ;
              SIZE 4, ScreenHeight() PIXEL ;
              OF oWnd ;
              STYLE

   @  0, nRightPos SPLITTER oVSplitR ;
             VERTICAL ;
             PREVIOUS CONTROLS oPanel2, oHSplitC, oPanel3 ;
             HINDS CONTROLS oPanel4 ;
             LEFT MARGIN 80 ;
             RIGHT MARGIN 80 ;
             SIZE 4, ScreenHeight() PIXEL ;
             OF oWnd ;
             STYLE
 
   ACTIVATE WINDOW oWnd MAXIMIZED ;
      ON RESIZE ( oVSplitL:AdjLeft(), oVSplitR:Adjust(),;
                  oPanel3:nHeight := oWnd:nHeight - oHSplitC:nBottom ) ;
                  ON INIT webshow(1,oPanel2:hWnd)

return nil

//----------------------------------------------------------------------------//


function webshow(console,cAufruf)
    local cHtmlOrUrl := "https://forums.fivetechsupport.com/viewforum.php?f=3&sid=bf7b6ffeb993b2f3fc02a92f7a3747a9"
   
        oWebView := TWebView():New( 1, cAufruf)
        oWebView:Bind( "SendToFWH" )
        oWebView:Navigate( cHtmlOrUrl )
        oWebView:SetTitle( "This is Fivewin 2024" )
        Sleep( 200 )
 
        oWebView:Run()
        oWebView:Destroy()
   
return nil    

//-----------------------------------------------------------------------------//
 
 



Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: HTML code in a TPanel class

Postby Otto » Sat Jan 20, 2024 5:06 pm

Here a demo how to display WEBVIEW2 in a Say object.

Code: Select all  Expand view


#include "FiveWin.ch"

//----------------------------------------------------------------------------//

function Main()

   local oDlg,oSay, lExit := .f., oBtn

   DEFINE DIALOG oDlg FROM 5, 5 TO 55, 180 TITLE "A Dialog Box"

 
 
 
            @ 10,10 ;
         SAY oSay ;
      PROMPT "Five Win" ;
       PIXEL ;
        SIZE 400, 300


 
 
 
 
   @ 20,  4 BUTTON "&Ok" OF oDlg SIZE 40, 12 ACTION  webshow( 1, oSay:hWnd)

   @ 20, 12 BUTTON oBtn PROMPT "&Cancel" OF oDlg SIZE 40, 12  
     

   ACTIVATE DIALOG oDlg  

return nil

//----------------------------------------------------------------------------//


function webshow(console,cAufruf)
    local cHtmlOrUrl := "https://forums.fivetechsupport.com/viewforum.php?f=3&sid=bf7b6ffeb993b2f3fc02a92f7a3747a9"
   msginfo( procname() + "   " + str(procline()) + "   " + str( 1 ) )
        oWebView := TWebView():New( 1, cAufruf)
        oWebView:Bind( "SendToFWH" )
        oWebView:Navigate( cHtmlOrUrl )
        oWebView:SetTitle( "This is Fivewin 2024" )
        Sleep( 200 )
 
        oWebView:Run()
        oWebView:Destroy()
   
return nil    

//-----------------------------------------------------------------------------//
 


 


Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: HTML code in a TPanel class

Postby nageswaragunupudi » Sun Jan 21, 2024 1:32 am

Wonderful
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: HTML code in a TPanel class

Postby Otto » Sun Jan 21, 2024 8:05 am

Dear Mr. Rao,
Thank you very much.

***
We have actually had WEBVIEW2 for a long time, but we don't really know what to do with it.

Until now, I only used WEBVIEW in a separate WINDOW.
Just yesterday, I looked at the TWebView source code and saw that it can be bound to all windows controls.
Here is a test with 3 SAYs.

By the way, all the pages you see in the SAYs are mod harbour pages!

Best regards,
Otto

Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: HTML code in a TPanel class

Postby nageswaragunupudi » Sun Jan 21, 2024 9:09 am

Thanks for the explanation.
Very useful.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: HTML code in a TPanel class

Postby richard-service » Sun Jan 21, 2024 11:45 am

Dear Mr.Otto

Thanks a lot.
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: 803
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan

Re: HTML code in a TPanel class

Postby Silvio.Falconi » Mon Jan 22, 2024 8:57 am

Otto wrote:Dear Mr. Rao,
Thank you very much.

***
We have actually had WEBVIEW2 for a long time, but we don't really know what to do with it.

Until now, I only used WEBVIEW in a separate WINDOW.
Just yesterday, I looked at the TWebView source code and saw that it can be bound to all windows controls.
Here is a test with 3 SAYs.

By the way, all the pages you see in the SAYs are mod harbour pages!

Best regards,
Otto




Questions

WebView use Activex ?
WevView id Supported on Win7,Win10,win11 ?
I saw WebView used only from Otto ?
(sorry if I allow myself this consideration but all the messages on the forum can be traced back to Mr. Otto and no one else so it would seem that whoever created the WebView class did it only and exclusively for Mr. Otto. E)

Some time ago he had created an application for the creation of teachers' instructions, the program connected to Telegram and sent information and from telegram information arrived in the application.

I had to give up because I always had problems in the various operating systems that the famous CreateObject( "MSXML2.DOMDocument" ) and CreateObject( "MSXML2.XMLHTTP" ) protocols did not work.

give me erros as

Error description: (DOS Error -2147352567) WINOLE/1007 Download della risorsa specificata non riuscito.
(0x800C0008): msxml3.dll

then I also tried with hbcurl with no success
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: HTML code in a TPanel class

Postby Antonio Linares » Mon Jan 22, 2024 10:09 am

Silvio,

> WebView use Activex ?

no

> WebView id Supported on Win7,Win10,win11 ?

https://learn.microsoft.com/en-us/microsoft-edge/webview2/
WebView2 is compatible with Windows 7, but only up to version 109 of WebView2 Runtime2. Subsequent versions of WebView2 Runtime and WebView2 SDK do not support Windows 7 or Windows 8/8.13. Therefore, if you want to use WebView2 on Windows 7, you must ensure that version 109 or earlier of WebView2 Runtime is installed, and use a version of WebView2 SDK that is equal to or less than 1.0.1519.0
regards, saludos

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

Re: HTML code in a TPanel class

Postby Silvio.Falconi » Mon Jan 22, 2024 10:12 am

Antonio Linares wrote:Silvio,

> WebView use Activex ?

no

> WebView id Supported on Win7,Win10,win11 ?

https://learn.microsoft.com/en-us/microsoft-edge/webview2/
WebView2 is compatible with Windows 7, but only up to version 109 of WebView2 Runtime2. Subsequent versions of WebView2 Runtime and WebView2 SDK do not support Windows 7 or Windows 8/8.13. Therefore, if you want to use WebView2 on Windows 7, you must ensure that version 109 or earlier of WebView2 Runtime is installed, and use a version of WebView2 SDK that is equal to or less than 1.0.1519.0


Antonio,
but is it only used to view web pages or is it also used to interact with web pages of the "GEt" and "Post" type?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7061
Joined: Thu Oct 18, 2012 7:17 pm

Re: HTML code in a TPanel class

Postby Antonio Linares » Mon Jan 22, 2024 10:23 am

Yes, you can interact with them.

Please review FWH\samples\webview*.prg

Also Mr. Otto has published very interesting and educational examples here in the forums!
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
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 85 guests