InsertImage Method


Applies to

THtmlViewer, TFrameViewer, and TFrameBrowser components

TFrameViewer Declaration

function InsertImage(Viewer: THtmlViewer; const Src: string; Stream: TMemoryStream): boolean;

THtmlViewer Declaration

function InsertImage(const Src: string; Stream: TMemoryStream): boolean;

Description

The InsertImage method allows images previously requested by the OnImageRequest event to be loaded at a later time. This allows images to be downloaded and inserted when available.

SrcThe identifier for the image originally obtained from the OnImageRequest event

ViewerThe destination THtmlViewer. This parameter is applicable to the TFrameViewer InsertImage method only. This parameter is obtained from the Sender parameter of the original OnImageRequest event.

StreamThe TMemoryStream being returned containing the image. Stream may contain a bitmap, GIF, JPEG, or PNG image. Returning a value of Nil will cause and error bitmap to be displayed for the image.

ReturnA True result indicates the image was accepted. A return of False indicates the image cannot be accepted at this time because something else in being processed. Another attempt should be made later.

A typical scenario for using the InsertImage method is as follows:

The HTML file is loaded. As this is processed, a series of OnImageRequest events occur.

The special WaitStream value is returned to the OnImageRequest event. This indicates that the image will be provided later. The Src and Sender parameters are saved.

The images are then downloaded. Meanwhile the HTML file is displayed with default images.

As the image information is obtained, the InsertImage method is called and the image is displayed.

See also:

OnImageRequest Event