rvico TRichView Reference | Overview

RichViewEdit: Inserting items in the position of caret

Top  Previous  Next

These methods are useful for implementing "Insert" menu in your application. All these methods:

1.check ReadOnly property (and do nothing in read-only mode);
2.delete the selected items;
3.insert item(s);
4.quickly reformat the changed part of the document;
5.repaint the editor;
6.generate OnChange event, set Modified to True.

The methods do nothing (and return True), if the selected text is modify/delete protected (or several cells of table are selected).

Inserting Text

These methods can insert several text items of the current text style (see CurTextStyleNo property):

procedure InsertText(const text: String; CaretBefore: Boolean=False);

procedure InsertTextW(const text: String; CaretBefore: Boolean=False);

function InsertTextFromFile(const FileName: String):Boolean;

function InsertTextFromFileW(const FileName: String):Boolean;

function InsertOEMTextFromFile(const FileName: String):Boolean;

These methods insert one text item (string must not contain line break, page break and tab characters) with the specified tag:

function InsertStringTag(const s: String; Tag: Integer): Boolean;

function InsertStringWTag(const s: WideString; Tag: Integer): Boolean;

Inserting Non-Text Items

These methods insert one item of the specified type (parameters are similar to parameters of Add*** methods):

function InsertControl(const Name: String; 

  ctrl: TControl; VAlign: TRVVAlign): Boolean;

function InsertPicture(const Name: String;

  gr: TGraphic; VAlign: TRVVAlign): Boolean;

function InsertHotPicture(const Name: String;

  gr: TGraphic; VAlign: TRVVAlign): Boolean;

function InsertBreak(Width: Byte; 

  Style: TRVBreakStyle; Color: TColor): Boolean;

function InsertBullet(ImageIndex: Integer; 

  ImageList: TCustomImageList): Boolean;

function InsertHotspot(ImageIndex, HotImageIndex: Integer;
  ImageList: TCustomImageList): Boolean;

Inserting Files and Streams

These methods insert RVF file or stream

function InsertRVFFromStreamEd(Stream: TStream):Boolean;
function InsertRVFFromFileEd(const FileName: String):Boolean;

These methods insert RTF (Rich Text Format) file or stream

function InsertRTFFromStreamEd(Stream: TStream):Boolean;
function InsertRTFFromFileEd(const FileName: String):Boolean;

These methods insert text of the current text style (see CurTextStyleNo property):

function InsertTextFromFile(const FileName: String):Boolean;

function InsertTextFromFileW(const FileName: String):Boolean;

function InsertOEMTextFromFile(const FileName: String):Boolean;

Inserting Tables

The most general method for inserting items is

function InsertItem(const Name: String; Item: TCustomRVItemInfo): Boolean;

It's recommended to use this method only for tables.

See also...

Methods for pasting from the Clipboard.


RichView © Sergey Tkachenko