rvico TRichView Reference | TRichView

RichView TRichView

Properties   Methods   Events

Top  Previous  Next

TRichView is a control for displaying documents with pictures, tables, Delphi controls and hyperlinks.

Unit RichView;


TCustomRichView = class(TRVScroller)

TRichView = class(TCustomRichView)

TRichView does not display its content if it is not linked to TRVStyle component via Style property.

The most important property settings can be done in the component editor for TRichView. In Delphi (C++Builder) IDE, right click the RichView object on the form, choose "Settings" in the context menu.










List of properties, events and methods

grouped in several categories (some entries can be in several groups)

DOWN General

DOWN Background

DOWN Appending Items

DOWN Hypertext

DOWN Style templates

DOWN Scrolling, margins, sizes

DOWN Selection and Clipboard

DOWN Saving and loading as RVF

DOWN Other methods for saving and loading

DOWN Information about items

DOWN Modifying items

DOWN Checkpoints

DOWN Mouse events

DOWN Unicode

DOWN Live spelling check

DOWN Picture animation

DOWN Working in palette mode

DOWN Other properties, methods and events

DOWN Obsolete properties and methods

General properties

Style link to RVStyle component defining a lot of properties which can be used in several RichViews;

Options some important options;

ItemCount number of items in the document.

Properties defining background




Appending items (Add*** methods)

Main methods for appending items:

AddNL adds one text item;

AddBreakEx adds break (horizontal line);

AddBulletEx adds bullet (image from ImageList);

AddHotspotEx adds hotspot (image from ImageList - hypertext link);

AddPictureEx adds picture;

AddHotPicture adds picture - hypertext link;

AddControlEx adds Delphi/C++Builder control;

AddTab adds tabulator;

AddItem general method for appending items (usually used for tables);

also AddNamedCheckpointEx adds checkpoint which will be associated with next added item.

"Tagged" analogs of the methods above (Add***Tag methods) (the same methods, but have additional Tag parameter):








also AddNamedCheckpointExTag and AddNLATag, AddNLWTag.

Additional methods for appending items:

Add adds one text item in last paragraph;

AddFmt adds one formatted string assembled from a Pascal format string and an array arguments;

AddTextNL, -A -W add several text items from text, separated by CR+LF characters;

AddBreak provides a subset of functionality of AddBreakEx;

also: AddCheckpoint provides subset of functionality of AddNamedCheckpointEx;

also Unicode-enabled methods.

"Tagged" analogs of the methods above:



also AddCheckpointTag.


AppendFrom copies content from another RichView;



See also

Clear clears document;


Format, FormatTail format the document;

Reformat reformats the document.


event OnJump occurs when user clicks hyperlink;

event OnRVMouseMove occurs when mouse pointer moves over hyperlink;

property FirstJumpNo use to set hypertext id for the first hypertext item;

GetJumpPointItemNo (deprecated) returns index of item with the specified hypertext id;

GetJumpPointLocation should be used instead of GetJumpPointItemNo in applications working with tables;

GetJumpPointY returns Y coordinate of item with the specified hypertext id.

Style templates


UseStyleTemplates allows or disallows using Style.StyleTemplates.

StyleTemplateInsertMode specifies how style templates are used when inserting RTF or RVF content.


OnStyleTemplatesChange occurs then the collection of style templates has been modified.

Scrolling, margins and sizes


LeftMargin, RightMargin, TopMargin, BottomMargin margins;

MaxTextWidth maximal width for word wrapping;

MinTextWidth minimal width for word wrapping (minimal width of scrollable area, not including margins);

DocumentHeight height of document (height of scrollable area);

VAlign vertical alignment of document;

VScrollVisible hides/shows vertical scrollbar;

HScrollVisible hides/shows horizontal scrollbar;

VSmallStep number of pixels in one step of vertical scrollbar;

FirstItemVisible the first visible item;

LastItemVisible the last visible item;

MaxLength maximal count of characters per line;

WordWrap allows to disable word wrapping;

Tracking whether RichView repaints while its scrollbar thumb tab is dragged with the mouse.


ClientToDocument converts client coordinates to document coordinates


OnVScrolled occurs when document is scrolled vertically

OnHScrolled occurs when document is scrolled horizontally


property CPEventKind

event OnCheckPointVisible

method GetItemCoords

Methods for working with selection and the Clipboard

SelectionExists returns "is something selected?"l


Copy copies selection to the Clipboard in all available formatsl

CopyDef copies selection to the Clipboard using formats specified in Options;

CopyImage copies selected image to the Clipboard;

CopyTextA copies selection as text to the Clipboard;

CopyTextW copies selection to the Clipboard as Unicode text;

CopyRVF copies selection as RVF to the Clipboard;

CopyRTF copies selection as RTF (Rich Text Format);


GetSelectedImage returns selected image

GetSelText returns selection as text

GetSelTextW returns selection as Unicode string;


GetOffsBeforeItem, GetOffsAfterItem return offset before/after the given item; useful with SetSelectionBounds;


SelectAll selects the whole document for copying to the Clipboard;

SetSelectionBounds selects the specified items;

SelectWordAt selects the word at (X,Y);

SelectControl selects a visual control;

Deselect clears selection (not contents, but bounds);


GetSelectionBounds returns bounds of selection;

event OnSelect occurs when selection bounds are changed;

event OnCopy allows to copy selection to the Clipboard in custom formats;

property SelectionHandlesVisible shows or hides selection handles for a touch screen.

Properties, methods and events for loading and saving RVF


RVFOptions – options for saving and loading RVF;

RVFWarnings describes warnings or errors occurred during the last reading of RVF.


OnRVFControlNeeded requests inserted control when reading RVF, if RVF was saved without controls' "bodies";

OnRVFImageListNeeded requests ImageList when reading bullet or hotspotfrom RVF;

OnRVFPictureNeeded requests image when reading RVF, if RVF was saved without images' "bodies".


SaveRVF saves document or selection as RVF to the file;

SaveRVFToStream saves document or selection as RVF to the stream;

LoadRVF loads RVF from the file;

LoadRVFFromStream loads RVF from the stream;

CopyRVF copies selection as RVF to the Clipboard;

InsertRVFFromStream inserts RVF from the stream;

AppendRVFFromStream appends RVF from the stream using the specified paragraph style for the first RVF item.


methods Copy, CopyDef.

Other saving and loading


LoadFromStream loads document in RVF, RTF or text formats;

LoadText appends text form the file;

LoadTextW appends text from the file in Unicode encoding;

LoadRTF, LoadRTFFromStream appends the file or the stream in RTF (Rich Text Format);

SaveHTML, SaveHTMLToStream save the document in an HTML file/stream using a basic HTML syntax;

SaveHTMLEx, SaveHTMLToStreamEx save the document in an HTML or XHTML file/stream using CSS;

SaveText, SaveTextToStream save the document in a file/stream as ANSI text;

SaveTextW, SaveTextToStreamW saves the document in a file/stream as a Unicode text;

SaveDocX, SaveDocXToStream saves the document (or selection) in a file/stream as DocX (Microsoft Word format);

SaveRTF, SaveRTFToStream saves the document (or selection) in a file/stream as RTF.


RTFOptions options for RTF export.


OnSaveComponentToFile allows to save inserted controls in HTML and text files;

OnWriteHyperlink, OnReadHyperlink allow to customize saving/loading of hypertext links in HTML and RTF files;

OnHTMLSaveImage, OnSaveImage2 allow to save images with HTML in custom formats and with custom file names;

OnSaveItemToFile allows to save any item in RTF, HTML or text files in your own format;

OnImportPicture allows custom processing of external images when importing RTF.

Information about items (Get***Info methods)

GetItemStyle returns a type of item;


GetTextInfo information about text item;

GetBreakInfo about "break";

GetBulletInfo about "bullet";

GetHotspotInfo about "hotspot";

GetPictureInfo about picture or "hot-picture";

GetControlInfo about inserted control;

GetItemExtraStrProperty[Ex] return value of extra item property;

GetItem general method for obtaining items (usually used for tables);


GetItemCheckpoint about item's "checkpoint";

GetItemVAlign about item's position relative to line;

GetItemTag about item's "tag";

GetItemText about text/name of item;

IsParaStart returns "is this item a first item in paragraph?";

IsFromNewLine returns "is this item a first item in paragraph?";

GetItemPara returns an index of paragraph containing a specified item;

GetItemNo returns item index for object representing item (usually used for tables);

GetItemCoords returns coordinates of item relative to document area, GetItemClientCoords returns coordinates of item relative to client area of RichView window;

properties PageBreaksBeforeItems, ClearLeft, ClearRight.

Modifying items  (Set***Info methods)

SetBreakInfo changes break;

SetBulletInfo changes bullet;

SetHotspotInfo changes hotspot;

SetPictureInfo changes picture or hot-picture;

SetControlInfo changes inserted control;

SetItemTag changes item's "tag";

SetItemVAlign – change the item position relative to the line;

SetItemText changes text/name of item;

SetItemExtraStrProperty[Ex] sets value of extra item property;

SetCheckpointInfo sets or changes item's "checkpoint";

RemoveCheckpoint removes item's "checkpoint";

see also properties PageBreaksBeforeItems, ClearLeft, ClearRight.

Working with checkpoints

Obtaining checkpoint data:

GetFirstCheckpoint, GetNextCheckpoint allow to receive full list of checkpoints;

GetLastCheckpoint, GetPrevCheckpoint – the same in backward direction;

GetCheckPointByNo returns a checkpoint with the specified index;

GetItemCheckpoint returns the item's checkpoint;

event OnCheckPointVisible occurs when checkpoint (or "section", marked by this checkpoint) becomes visible as a result of vertical scrolling;

FindCheckPointByName searches for checkpoint with the specified name;

FindCheckPointByTag searches for checkpoint with the specified tag.

Extracting properties from checkpoint data:

GetCheckpointInfo returns main properties of the checkpoint;

GetCheckpointItemNo returns an index of item which owns the checkpoint;

GetCheckpointNo returns an index of the checkpoint;

GetCheckpointYEx, GetCheckpointXY returns coordinates of the checkpoint.


GetCheckPointY returns Y coordinate of checkpoint by its index.

See also methods for obtaining information about items and for modifying document.

Mouse events

OnRVDblClick occurs on double click;

OnRVMouseDown occurs when user presses mouse button;

OnRVMouseUp occurs when user releases mouse button;

OnRVRightClick occurs on right click.

OnItemHint allows customizing hints displayed when the mouse pointer moves above an item.

OnGetItemCursor allows customizing cursors displayed when the mouse pointer moves above an item.

See also hypertext events.

Live spelling check

StartLiveSpelling starts live spelling thread;

ClearLiveSpellingResults clears live spelling underlines and stops the thread;

LiveSpellingValidateWord removes live spelling underlines from the specified word;

OnSpellingCheck event – the place to check word spelling.

Picture animation


AnimationMode specifies when image animation starts.


StartAnimation starts all animations;

StopAnimation stops all animations;

ResetAnimation rewinds all animations to the first frame.

Unicode (in Delphi 3-2007)

AddNLATag adds one text item in ANSI encoding;

AddNLWTag adds one text item in Unicode encoding;

AddTextNLW adds one or more text items in Unicode encoding;

LoadTextW, LoadTextFromStreamW appends text from file/stream in Unicode encoding;

SaveTextW, SaveTextToStreamW saves Unicode file/stream;

GetSelTextW returns selection as Unicode string;

CopyTextW copies selection to the Clipboard as Unicode.

Working in palette mode

property DoInPaletteMode;

method UpdatePaletteInfo.



RVData object representing document;

Cursor cursor;

Delimiters characters not belonging to words;

TabNavigation sets mode for navigation through hypertext links and controls;

AnimationMode defines when animated images starts animation;

DocObjects additional object information for saving in RVF;

DocProperties additional text information for saving in RVF;

DocParameters store document page parameters;

NoteText text for references to parent notes.


DeleteUnusedStyles deletes unused text, paragraph and list styles from TRVStyle;

MarkStylesInUse, DeleteMarkedStyles – advanced methods for deleting unused styles;

SearchText, -A, -W search for the text string;

GetWordAt returns a word at the specified point;

DeleteItems, DeleteSection delete the specified range of items from document;

DeleteParas deletes the specified range of paragraphs, updates the document;

FindControlItemNo returns index of item which owns the specified inserted control;

GetFocusedItem returns the item in the focus;

GetLineNo returns line number in the specified position;

BeginOleDrag starts drag&drop.




Obsolete properties and methods:

AddBullet, AddCenterLine, AddControl, AddFromNewLine, AddHotspot, AddNamedCheckPoint, AddPicture, AllowSelection, AddText, AddTextFromNewLine, LineCount, SingleClick.

TRichView © trichview.com