Class XbpHTMLViewer() Foundation
Class function of the XbpHTMLViewer class.
The XbpHTMLViewer class encapsulates the Windows Internet Explorer ActiveX control. It can be used by Xbase++ applications to browse Web sites and/or view Web pages or other HTML-formatted text. In addition, the XbpHTMLViewer class supports opening ActiveX documents. If Microsoft Office is installed on the computer, an application can use an XbpHTMLViewer instance to display Word or Excel documents. XbpHTMLViewer objects can also be used to browse files and folders on the local hard disk or a network.
//
// Example for using the XbpHTMLViewer Xbase Part
// to browse a Web site
//
#include "XBP.CH"
#include "AppEvent.CH"
PROCEDURE Main()
LOCAL oDlg
LOCAL oHTML
LOCAL nEvent, mp1, mp2, oXbp
LOCAL oDA
//
// Create application's main dialog
//
oDlg := XbpDialog():new( Appdesktop() )
oDlg:title := "HTML Viewer Example"
oDlg:taskList := .T.
oDlg:close := {|| PostAppEvent(xbeP_Quit,,, oDlg) }
oDA := oDlg:drawingArea
oDlg:create( ,, {50,50}, {640,480},, .F. )
oDA:resize := {|| ResizeControl(oHTML)}
//
// Create the XbpHTMLViewer object
//
oHTML := XbpHTMLViewer():new( oDA )
oHTML:create( ,, {10,10},{450,300} )
//
// Navigate to "www.alaska-software.com"
//
oHTML:navigate( "www.alaska-software.com" )
//
// Display the main dialog and process
// application events until the dialog
// is closed
//
ResizeControl( oHTML )
oDlg:show()
SetAppWindow( oDlg )
SetAppFocus( oHTML )
nEvent := xbeP_Quit
DO WHILE nEvent != xbeP_Close
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
oDlg:destroy()
RETURN
// Resize HTML viewer object to always span the
// whole of the dialog's drawing area.
PROCEDURE ResizeControl( oHTML )
LOCAL oParent := oHTML:setParent()
oHTML:setPosAndSize( {0,0}, oParent:currentSize() )
RETURN
// Overloaded AppSys() procedure to prevent
// creation of the default XbpCrt window
PROCEDURE AppSys()
RETURN
//
// Example for using the XbpHTMLViewer Xbase Part
// to browse a folder
//
#include "XBP.CH"
#include "AppEvent.CH"
PROCEDURE Main()
LOCAL oDlg
LOCAL oHTML
LOCAL nEvent, mp1, mp2, oXbp
LOCAL oDA
//
// Create application's main dialog
//
oDlg := XbpDialog():new( Appdesktop() )
oDlg:title := "HTML Viewer Example"
oDlg:taskList := .T.
oDlg:close := {|| PostAppEvent(xbeP_Quit,,, oDlg) }
oDA := oDlg:drawingArea
oDlg:create( ,, {50,50}, {640,480},, .F. )
oDA:resize := {|| ResizeControl(oHTML)}
//
// Create the XbpHTMLViewer object
//
oHTML := XbpHTMLViewer():new( oDA )
oHTML:create( ,, {10,10},{450,300} )
//
// Navigate to folder "C:\".
//
//
oHTML:navigate( "C:\" )
//
// Display the main dialog and process
// application events until the dialog
// is closed
//
ResizeControl( oHTML )
oDlg:show()
SetAppWindow( oDlg )
SetAppFocus( oHTML )
nEvent := xbeP_Quit
DO WHILE nEvent != xbeP_Close
nEvent := AppEvent( @mp1, @mp2, @oXbp )
oXbp:handleEvent( nEvent, mp1, mp2 )
ENDDO
oDlg:destroy()
RETURN
// Resize HTML viewer object to always span the
// whole of the dialog's drawing area.
PROCEDURE ResizeControl( oHTML )
LOCAL oParent := oHTML:setParent()
oHTML:setPosAndSize( {0,0}, oParent:currentSize() )
RETURN
// Overloaded AppSys() procedure to prevent
// creation of the default XbpCrt window
PROCEDURE AppSys()
RETURN
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.