|
<< 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.
Opaque selection drawing
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.
Transparent selection drawing
This mode is used when RichView.Style.SelOpacity < 100000 (meaning semitransparency).
In this mode, only SelColor and InactiveSelColor are used (SelTextColor and InactiveSelTextColor are ignored). Selection is shaded with SelColor (if the control is focused) or InactiveSelColor (if not focused).
Highlighting document items / lines
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 RTF (SaveRTFToStream, SaveRTF), DocX (SaveDocXToStream, SaveDocX), Markdown (SaveMarkdownToStream, SaveMarkdown), RVF (SaveRVFToStream, SaveRVF)
▪get the selection as an image, if image is selected (GetSelectedImage);
▪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.