Class XbpHTMLViewer() Foundation

Class function of the XbpHTMLViewer class.

Superclass
Description

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.

To function properly, the XbpHTMLViewer class requires a certain system component, the Microsoft Webbrowser ActiveX control, to be installed on your computer. For this component to be available, Internet Explorer 4.01 or higher must be installed on the target computer. An installation package with the required system files for using the XbpHTMLViewer Xbase Part is available from Alaska Software. The corresponding archive should be located on your Xbase++ disk or CD ROM. For further information, please click the 'Info' button on this page.

Class methods
:new()
Creates an instance of the XbpHTMLViewer class.
Life cycle
:create()
Requests system resources for the object.
:configure()
Reconfigures the XbpHTMLViewer object after :create() has been executed.
:destroy()
Releases the system resources of the object.
Display methods
:setHTML()
Assigns HTML-formatted text to the object.
Navigation methods
:back()
Navigates to the previous location stored in the history.
:forward()
Navigates to the next location stored in the history.
:home()
Navigates to the Home page.
:isBusy()
Indicates if a document or HTML page is currenly being loaded.
:navigate()
Navigates to the specified URL.
:refresh()
Reloads the current document.
:search()
Navigates to the default search page.
:stop()
Aborts loading of a HTML page.
Event handling
:beforeNavigate
Indicates that a navigation is about to commence.
:documentComplete
Indicates that a document is completely loaded.
:navigateComplete
Indicates that a navigation is complete.
:progressChange
Indicates a change in progress of the current operation.
:statusTextChange
Indicates a changed status text of the XbpHTMLViewer object.
:titleChange
Indicates that the title of the current document has changed.
Examples
Example for using XbpHTMLViewer to browse a Web site

 // 
 // 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 XbpHTMLViewer to browse a folder
 // 
 // 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 
Feedback

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.