<< Click to display table of contents >>


Occurs when reading picture or hot-picture from RVF file or stream, and this picture was saved without its "body"


  TRVFPictureNeededEvent = procedure (Sender: TCustomRichView

    const ItemName: TRVUnicodeString; Item: TRVNonTextItemInfo

    Index1, Index2: Integer; var gr: TGraphic) of object;


property OnRVFPictureNeeded: TRVFPictureNeededEvent;

(the parameters are changed in version 14 and 18)

By default, images are stored inside RVF documents.

If you exclude rvfoSavePicturesBody from RichView.RVFOptions, images are not saved. Only item name (value returned by GetItemText) and tag (value returned by GetItemTag) are saved. These values allow to identify the image on loading. When reading such RVF files, OnRVFPictureNeeded is called for each image.

This event is called for the following objects:

pictures and hot-pictures;

table background images (even if the saved table did not have a background image initially)

table cell background images (for each table cell, even for cells that did not have a background image initially)


Input parameters:

ItemName the name of the item (this is a value returned by GetItemTextW). This parameter is empty when the event is called for a table cell.

Item the item that will use this image. This is an object of one of the following types: TRVGraphiItemInfo, TRVHotGraphiItemInfo, TRVTableItemInfo.

Index1, Index2 integer values allowing to identify image inside the item. When called for a picture, a hot-picture, or a table, they are (-1, -1). When called for a table cell, Index1 contains the row index, Index2 contains the column index.

Output parameter:

gr image (for example, of TBitmap type) to insert in the document. Create it in this event. Do not destroy it (RichView will destroy it when necessary)


The following values may be useful:


if Item is TRVGraphicItemInfo: TRVGraphicItemInfo(Item).ImageWidth and TRVGraphicItemInfo(Item).ImageHeight (a size of a stretched picture)

if Item is TRVGraphicItemInfo: TRVGraphicItemInfo(Item).ImageFileName

if Item is TRVTableItemInfo: TRVTableItemInfo(Item).BackgroundImageFileName

See also:

RVF overview, contains an example.