Using the TFrameBrowser Component

Overall Approach

To use the TFrameBrowser component, you must have event handlers that respond to the OnGetPostRequest and the OnGetImageRequest events. These events occur whenever a document or an image for a document is requested. These events require that the document or image be returned in stream form. In some cases, the return of the stream may be delayed to allow for downloading the information.

The general sequence of loading a document is as follows:

  1. Call the LoadURL method. The URL parameter supplied should be a full URL and include the protocol.
  2. An immediate OnGetPostRequest event will occur.  Respond with the stream requested.
  3. Assuming the document contains images, a number of OnGetImageRequest events will occur. Again respond with a stream for each.
  4. Once the document is loaded, additional events will occur when links are selected, etc.

Further information on the OnGetPostRequest and OnGetImageRequest events is available in the htmlview.hlp file.

Connections

To obtain the document and image streams, the demo programs establish a connection. A connection is obtained by calling TURLConnection.GetConnection and the proper type of connection is determined by the protocol on the URL used in the call. It is through the connection concept that the various protocols are supported. The Connection concept makes it easy to add new protocols for specialized situations.

Once the Connection is established, the stream may be obtained, usually with the Connection.Get method.