RichEdit
Description
The component is an advanced text editor with wide possibilities for text formatting. With the ability to insert graphics files, tables, links, etc. The data storage format is RTF (Rich Text Format).
Class: TdbRichEdit
Properties
Property |
Type |
Description |
dbTable |
String |
Determines which database table a component belongs to. |
dbField |
String |
Determines which field of the database table this component belongs to. |
sqlValue |
String |
Returns the value of a component, for use in SQL queries. The property value already contains escape quotes. In case of empty value, it returns NULL string. |
Enabled |
Boolean |
Controls whether the component responds to mouse, keyboard, and timer events. |
ItemCount |
Integer |
Number of items in the component. |
Name |
String |
The name of the component. |
Ruler |
Boolean |
Determines the visibility of the rulers. |
SelLength |
Integer |
Specifies the number of characters that are selected. |
SelStart |
Integer |
Specifies the position of the first selected character in the text. If there is no selected text, SelStart indicates the position of the cursor. |
Modified |
Boolean |
Value of this property is True if document was modified |
ReadOnly |
Boolean |
Determines whether the user can change the text of the RichEdit component. |
TabOrder |
Integer |
Indicates the position of the component in its parent's tab order. TabOrder is the order in which child components are visited when the user presses the Tab key. |
TabStop |
Boolean |
Determines whether the user can tab to a control. Use the TabStop to allow or disallow access to the control using the Tab key. |
Text |
String |
Contains a text string associated with the component. |
TextRTF |
String |
Allows you to retrieve and assign text to a document in RTF format. |
ToolBar1 |
Boolean |
Defines the visibility of the first row toolbar. |
ToolBar2 |
Boolean |
Defines the visibility of the second row toolbar. |
ToolBar3 |
Boolean |
Defines the visibility of the third row toolbar. |
Visible |
Boolean |
Specifies whether the component appears onscreen. |
VScrollVisible |
Boolean |
Set to False to hide vertical scrollbar. |
WheelStep |
Integer |
Defines how much the document will be scrolled when the user turns a mouse wheel. If set to 0, the control ignores mouse wheel messages. |
Left |
Integer |
Specifies the horizontal coordinate of the left edge of a component relative to its parent. |
Top |
Integer |
Specifies the vertical coordinate of the upper-left of a component relative to its parent. |
Width |
Integer |
Specifies the horizontal size of the component in pixels. |
Height |
Integer |
Specifies the vertical size of the component in pixels. |
Tag |
Integer |
Allows you to assign a number to a component for your own needs. |
TagString |
String |
Allows you to assign a string to a component for your own needs. |
Methods
Method |
Description |
procedure AddHotPicture (const Name: String; gr: TGraphic; ParaNo: Integer = -1; VAlign: TRVVAlign = rvvaBaseline) |
Adds picture-hyperlink to the end of document. More info. |
procedure AddHyperlink (const s: String; url: String) |
Adds a link to the end of the document. More info. |
procedure AddNL (const s: String; StyleNo: Integer; ParaNo: Integer = -1) |
Adds a text element to the end of the document. More info. |
procedure AddPicture (const Name: String; gr: TGraphic; ParaNo: Integer = -1; VAlign: TRVVAlign = rvvaBaseline) |
Adds a picture to the end of document. More info. |
procedure AddTab (TextStyleNo, ParaNo: Integer) |
Adds tabulator to the end of document. More info. |
procedure AddTextNL (const s: String; StyleNo, FirstParaNo, OtherParaNo: Integer; AsSingleParagraph: Boolean = False) |
Adds one or more text lines to the end of document. More info. |
function AppendRTF (const FileName: String): Boolean |
Adding the contents of an RTF file to a document. |
function AppendRTFFromStream (Stream: TStream): Boolean |
Adding the contents of an RTF stream to a document. More info. |
function AppendTextA (const FileName: String; StyleNo, ParaNo: Integer; AsSingleParagraph: Boolean): Boolean |
Adding an ANSI encoded text file to the document. More info. |
function AppendText (const FileName: String; StyleNo, ParaNo: Integer; DefAsSingleParagraph: Boolean): Boolean |
Adding the contents of a UTF-16 encoded text file to the document. More info. |
function AppendTextFromStreamA (Stream: TStream; StyleNo, ParaNo: Integer; AsSingleParagraph: Boolean): Boolean |
Adding ANSI encoded text stream content to the document. More info. |
function AppendTextFromStream (Stream: TStream; StyleNo, ParaNo: Integer; DefAsSingleParagraph: Boolean): Boolean |
Adding the contents of a UTF-16 encoded text stream to the document. More info. |
procedure ApplyTextStyle (TextStyleNo: Integer) |
Not used. |
function CanFocus: Boolean |
Indicates whether a control can receive focus. Usually the property is used together with the SetFocus method. Example: if Form1.RichEdit1..CanFocus then Form1.RichEdit1.SetFocus; |
procedure Clear |
Clears the document. |
procedure Copy |
Copies the selected fragment to the Clipboard in all available formats (as text, RVF, RTF and picture) |
procedure CopyImage |
Copies the selected image to the Clipboard. |
procedure CopyRTF |
Copies the selected part of the document to the Clipboard as RTF (Rich Text Format). |
procedure CopyText |
Copies the selected text to the clipboard in UTF-16 encoding. |
procedure CopyTextA |
Copies the selected text to the clipboard in ANSI encoding. |
procedure DeleteItems (FirstItemNo, Count: Integer) |
Removes the specified number of items (Count) from the document, starting from the FirstItemNo-th item. |
procedure DeleteSelection |
Deletes the selected fragment in the editor. |
procedure Deselect |
Removes the document selection (does not change document). |
function Focused: Boolean |
Determines whether the control has input focus. |
procedure Format |
Formats the document. This method must be called to apply the changes that were made by the methods: AddHotPicture, AddHyperlink, AddNL, AddPicture, etc. |
procedure FormatTail |
Formats a part of document appended after the last call of Format or FormatTail. This method works properly only if new items were added from new line (as new paragraphs) after the last call of Format or FormatTail. It's much more efficient to reformat only a new part of the document than making a full reformatting. This method is designed specially for chat/log windows. |
procedure Reformat |
Formats the document while keeping the selection and the cursor position. |
function GetSelectedImage: TGraphic |
This method returns image, if the selection consist only of one image. If there is nothing selected, or not only image is selected, this method returns nil. More info. |
function GetSelText: String |
Returns the selected part of the document as a text. |
procedure InsertHyperlink (const s: String; url: string) |
Inserts a link at the cursor position. More info. |
function InsertPicture (const Name: String; gr: TGraphic; VAlign: TRVVAlign = rvvaBaseline): Boolean |
Inserts a picture at the cursor position. More info. |
function InsertRTFFromFileEd (const FileName: String): Boolean |
Inserts RTF (Rich Text Format) from file FileName in the position of caret. |
function InsertRTFFromStreamEd (Stream: TStream): Boolean |
Inserts the contents of the RTF stream into the document at the cursor position. More info. |
procedure InsertText (const text: String; CaretBefore: Boolean=False) |
Inserts text at the cursor position. More info. |
procedure InsertTextEx (const text: String; FontColor: TColor = -1; FontSize: integer = -1; FontStyles: Integer = -1; FontName: string = '') |
Inserts text at the cursor position with the ability to specify color, size, style and font name. More info. |
function InsertTextFromFileA (const FileName: String): Boolean |
Inserts into a document the contents of a text file in ANSI encoding. |
function InsertTextFromFile (const FileName: String): Boolean |
Insert the contents of a UTF-16 encoded text file into the document. |
function LoadHTML (const FileName: String): Boolean |
Load an HTML file. |
function LoadRTF (const FileName: String): Boolean |
Appends the content of RTF (Rich Text Format) file FileName to the document. |
function LoadRTFFromStream (Stream: TStream): Boolean |
Appends the content of RTF (Rich Text Format) stream Stream to the document. More info. |
function LoadTextA (const FileName: String; StyleNo, ParaNo: Integer; AsSingleParagraph: Boolean): Boolean |
Append the content of the text file FileName in ANSI encoding to the document. More info. |
function LoadText (const FileName: String; StyleNo, ParaNo: Integer; DefAsSingleParagraph: Boolean): Boolean |
Append the content of the text file FileName in UTF-16 encoding to the document. More info. |
function LoadTextFromStreamA (Stream: TStream; StyleNo, ParaNo: Integer; AsSingleParagraph: Boolean): Boolean |
Append ANSI encoded text stream to the document. More info. |
function LoadTextFromStream (Stream: TStream; StyleNo, ParaNo: Integer; DefAsSingleParagraph: Boolean): Boolean |
Append UTF-16 encoded text stream to the document. More info. |
procedure Paste |
Pastes document from the Clipboard in the position of caret. |
procedure PasteRTF |
Inserts RTF (Rich Text Format) from the Clipboard in the position of caret. |
procedure PasteText |
Insert text in UTF-16 encoding from the Clipboard in the position of caret. |
procedure PasteTextA |
Insert text in ANSI encoding from the Clipboard in the position of caret. |
function SaveDocX (const FileName: String; SelectionOnly: Boolean = False): Boolean |
Exports document (or the selected part, if SelectionOnly=True) to the file FileName as DocX (Microsoft Word format). More info. |
function SaveDocXToStream (Stream: TStream; SelectionOnly: Boolean = False): Boolean |
Exports document (or the selected part, if SelectionOnly=True) to the stream Stream as DocX (Microsoft Word format). More info. |
function SaveHTML (FileName, Title: String; ImagesPrefix: String = ''): Boolean |
Exports document to HTML or XHTML file, using HTML tags like <font>, <b>, <div>, etc and a set of images (in separate files). More info. |
function SaveHTMLEx (const FileName, Title, ImagesPrefix, ExtraStyles, ExternalCSS: String): Boolean |
Exports document to HTML or XHTML file, using CSS (Cascading Style Sheets) and a set of images (in separate files). More info. |
function SaveHTMLToStream (Stream: TStream; const Path, Title, ImagesPrefix: String): Boolean |
Exports document as HTML or XHTML to the stream Stream, using HTML tags like <font>, <b>, <div>, etc and creates files for images. |
function SaveRTF (const FileName: String; SelectionOnly: Boolean = False): Boolean |
Exports document (or the selected part, if SelectionOnly=True) to the file FileName as RTF (Rich Text Format). More info. |
function SaveRTFToStream (Stream: TStream; SelectionOnly: Boolean = False): Boolean |
Exports document (or the selected part, if SelectionOnly=True) to the Stream as RTF (Rich Text Format). More info. |
function SaveText (const FileName: String; LineWidth: Integer = 0): Boolean |
Exports document to UTF-16 text file. |
function SaveTextA (const FileName: String; LineWidth: Integer = 0): Boolean |
Exports document to ANSI text file. |
function SaveTextToStreamA (const Path: String; Stream: TStream; LineWidth: Integer; SelectionOnly, TextOnly: Boolean): Boolean |
Exports document or selection as ANSI text. More info. |
function SaveTextToStream (const Path: String; Stream: TStream; LineWidth: Integer; SelectionOnly, TextOnly: Boolean): Boolean |
Exports document or selection as UTF-16 text. More info. |
function SearchText (s: String; MatchCase: boolean = False; Down: boolean = True; WholeWord: boolean = False; MultiItem: boolean = True; SmartStart: boolean = False): Boolean |
Search for the substring s in the document. More info. |
procedure SelectAll |
Selects all text in the RichEdit component. |
procedure SetFocus |
Gives the input focus to the component. |
procedure SelectionToHyperlink (url: string) |
Converts the selected text to a link with the specified URL. |
Events
Event |
Description |
OnClick |
Occurs when the user clicks the component. |
OnDoubleClick |
Occurs when the user double-clicks the left mouse button when the mouse pointer is over the component. |
OnEnter |
Occurs when a component receives the input focus. |
OnExit |
Occurs when the input focus shifts away from one component to another. |
OnKeyDown |
Occurs when a user presses any key while the form has focus. |
OnKeyPress |
Occurs when a key is pressed. Note that this procedure handles printable characters only. |
OnKeyUp |
Occurs when the user releases a key that was pressed. |
OnMouseDown |
Occurs when the user presses a mouse button with the mouse pointer over a component. |
OnMouseEnter |
Occurs when the user moves the mouse into a component. |
OnMouseLeave |
Occurs when the user moves the mouse outside of a component. |
OnMouseMove |
Occurs when the user moves the mouse pointer while the mouse pointer is over a component. |
OnMouseUp |
Occurs when the user releases a mouse button that was pressed with the mouse pointer over a component. |
Occurs when user tries to drag and drop a file from explorer to a form. More info. |