TRichView Reference | Global procedures and functions
Functions from RVLinear Unit
|Top Previous Next|
const RVCharsPerLineBreak: Integer = 1;
RVNonTextCharacter: TRVUnicodeChar = ' ';
function RVGetLinearCaretPos(rve: TCustomRichViewEdit): Integer;
procedure RVSetLinearCaretPos(rve: TCustomRichViewEdit; LinearPos: Integer);
RVGetLinearCaretPos returns the caret position (as a number of characters before the caret; non-text objects (except for the tables and tabulators) are treated as one character, line breaks are treated as RVCharsPerLineBreak characters). RVSetLinearCaretPos moves the caret to the specified position.
procedure RVGetSelection(rv: TCustomRichView; out SelStart, SelLength: Integer);
procedure RVSetSelection(rv: TCustomRichView; SelStart, SelLength: Integer);
RVGetSelection returns the selection position in richedit-like parameters (SelStart and SelLength). RVSetSelection sets selection by these values.
TRVSelection = record
SelStart, SelLength: Integer;
StartRow, StartCol, RowOffs, ColOffs: Integer;
procedure RVGetSelectionEx(rv: TCustomRichView; out Selection: TRVSelection);
procedure RVSetSelectionEx(rv: TCustomRichView; const Selection: TRVSelection);
RVGetSelectionEx returns the selection position in TRVSelection record. RVSetSelectionEx sets selection by this record. These function can handle not only a normal selection, but a multicell selection in tables as well.
ItemNo, ItemOffs: Integer; out LinearPos: Integer): Boolean;
var LinearPos: Integer; out RVData: TCustomRVData;
out ItemNo, ItemOffs: Integer): Boolean;
RichViewToLinear converts the position specified in RichView coordinates (RVData – document, ItemNo – index of item in this document, ItemOffs – offset in this item) to linear coordinate (a number of characters from the beginning of CurRVData before this position; non-text objects (except for the tables and tabulators) are treated as one character, line breaks are treated as RVCharsPerLineBreak characters). LinearToRichView performs an opposite conversion.
function RVGetTextLength(rv: TCustomRichView): Integer;
RVGetTextRange returns text from rv, from RangeStart to RangeLength position. Non-text items (except for the tables and tabulators) are returned as RVNonTextCharacter. If RVCharsPerLineBreak=1, #13 is used as line break. If RVCharsPerLineBreak=2, #13#10 is used as line break.
The call RVGetTextRange(rv, 0, RVGetTextLength(rv)) returns the whole text.
All these functions are compatible, they calculate position identically. The text returned by RVGetTextRange has one-to-one correspondence to RichView document (unlike text returned by the functions from RVGetText unit).
TRichView © trichview.com