<< Click to display table of contents >> Selecting Part of TRichView Document |
User can select a part TRichView document with the mouse (in TRichViewEdit he/she also can use Shift +caret movement keys).
You can turn off/on a word selection mode, see TRVStyle.SelectionMode.
Selected text has RichView.Style.SelTextColor/InactiveSelTextColor color and RichView.Style.SelColor/InactiveSelColor background.
By default, it is clHighlightText on clHighlight both for active (focused) and inactive windows.
See also RVStyle.SelectionStyle.
You can:
▪disallow making selection (clear rvoAllowSelection in Options); please do not use in editor!
▪determine if the selection is not empty (SelectionExists);
▪deselect TRichView (Deselect; Invalidate);
▪select the whole document (SelectAll; Invalidate);
▪get selection bounds (GetSelectionBounds);
▪select a part of the document (SetSelectionBounds;Invalidate);
▪select the inserted control (SelectControl);
▪get the selection as a text (GetSelText, GetSelTextW);
▪get the selection as a Rich Text Format (SaveRTFToStream, SaveRTF);
▪get the selection as an image, if image is selected (GetSelectedImage);
▪save the selection to stream or file (SaveRVFToStream, SaveRVF);
▪copy the selection to the Clipboard in various formats (see RichView Clipboard Functions Overview)
In editor you can:
▪delete selection (DeleteSelection);
▪select the current word or line;
▪cut selection to the Clipboard (CutDef);
Note: All methods introduced in RichView which can change visual appearance require calling Invalidate or Refresh after them.
Note: All methods working with selection must be called only when the document is formatted.