Classes

Class XbpHTMLWindow() Foundation

Class function of the XbpHTMLWindow class.

Superclass
Description

The XbpHTMLWindow class provides a windowed container which can display HTML pages using the HTMLayout lightweight HTML/CSS renderer. Instances of the XbpHTMLWindow class are intended for usage in conjunction with other Xbase Parts.

Unlike the XbpHTMLViewer() class which wraps an instance of Internet Explorer, HTML window objects do not require specific operating system components to be installed. Instead, all the required components ship as a part of Xbase++ and hence can be deployed along with the Xbase++ application.

Once the HTML window is created, the application can interact with the elements defined in the HTML markup. This is done through XbpHTMLElement() objects which represent individual elements in the HTML markup. The method :childFromId()can be used to retrieve an XbpHTMLElement object for a certain HTML element. This allows registering event handlers for reacting to the user clicking the mouse over a certain HTML element, for example.

Configuration
:HTML
The HTML markup displayed by the object.
Manipulation
:setHTML()
Changes the HTML markup displayed by the object.
Methods for accessing view elements
:childFromId()
Retrieves an HTML element given its identifier.
:childFromName()
Retrieves an HTML element given its name.
:childsFromSelector()
Retrieves the HTML elements matching a specified CSS selector.
:getNoIVar()
Retrieves an HTML element given its identifier.
Examples
Creating a simple HTML window

// In the example, an HTML window object is 
// created. An event handler is registered 
// for handling mouse clicks on an <div> 
// element which is defined in the HTML 
// markup. 

#pragma library( "xppwui.lib" ) 

PROCEDURE Main 
 LOCAL cHTML 
 LOCAL oXbp 
 LOCAL oElem 

   // Define the HTML markup to be displayed 
   // in the HTML window. Note the HTML 
   // <div> element with the id "mydiv" 
   TEXT INTO cHTML WRAP 
    <html> 
     <body> 
       <div id="mydiv">Click me!</div> 
     </body> 
    </html> 
   ENDTEXT 

   // Create the HTML window object 
   // and assign the HTML markup 
   oXbp := XbpHTMLWindow():new() 
   oXbp:HTML := cHTML 
   oXbp:create( , , {10,20}, {200,200} ) 

   // Retrieve the HTML element which 
   // represents the <div> in the HTML 
   // markup and register a callback 
   // code block for handling mouse 
   // events 
   oElem := oXbp:mydiv 
   oElem:lbDown := {|| MsgBox("<div> was clicked!") } 

   // Process events until the application 
   // window is closed 
   SetAppWindow():showModal() 
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.