Skip to content

Class: cRichEdit

Properties | Events | Methods | Index of Classes

Allows the user to enter and edit rich-text format (RTF) text

Hierarchy

cObject > cUIObject > DfBaseObject > DfBaseWindow > DfBaseUIWindow > DfBaseControl > DfBaseRichEdit > cRichEdit

Show full hierarchy and direct subclasses

Library: Windows Application Class Library

Package: cRichEdit.pkg

Mixins: cEdit_Mixin

Description

The cRichEdit class allows the user to enter and edit text while also providing more advanced formatting features than the plain-text cTextEdit class.

The cDbRichEdit class is a data-aware class similar to the cRichEdit class. The cTextEdit class is a plain-text class similar to the cRichEdit class.

The default maximum number of characters for the control is 64 KB (65536 bytes or characters). This can be changed or retrieved via piMaxChars.

Sample

Object oRichEdit1 is a cRichEdit
    Set Size to 168 276
    Set Location to 6 10
    Set peAnchors to anAll
End_Object    // oRichEdit1

Syntax

Use cRichEdit.pkg

Object oObjectName is a cRichEdit
    Set Size to iHeight iWidth
    Set Location to iRow iColumn

    Set Label to sLabelText
    Set Label_Justification_Mode to jMode
    Set Label_Row_Offset to iOffset
    Set Label_Col_Offset to iOffset

    Set Status_Help to sStatusHelpText
    Set Enabled_State to True | False
End_Object  // oObjectName

Text Formatting

An application can send messages to a rich edit control to format characters and paragraphs to retrieve formatting information. Paragraph formatting attributes include alignment, tabs, indents, numbering, and simple tables. For characters, you can specify font name, size, color, and effects such as bold, italic, and protected.

The character formatting of the insertion point is applied to newly inserted text only if the current selection is empty (if the current selection is an insertion point). Otherwise, the new text assumes the character formatting of the text it replaces. If the selection changes, the default character formatting changes to match the first character in the new selection.

Current Selection in a Rich Edit Control

The user can select text in a rich edit control by using the mouse or the keyboard. The current selection is the range of selected characters, or the position of the insertion point if no characters are selected. An application can get information about the current selection, set it, determine when it changes, and show or hide the selection highlight.

Word and Line Breaks

A rich edit control calls a function called a word-break procedure to find breaks between words and to determine where it can break lines. The control uses this information when performing word-wrap operations and when processing CTRL+LEFT ARROW key and CTRL+RIGHT ARROW key combinations. An application can send messages to a rich edit control to replace the default word-break procedure, to retrieve word-break information, and to determine what line a given character falls on.

A linefeed (LF) character can be added to text programmatically by adding ASCII character 10 to a string using the character function. A carriage return (CR) character can be added to text programmatically by adding ASCII character 13 to a string using the character function. Either a LF or CR character will break the current line in the control. Also see AppendTextLn.

Rich Edit Shortcut Keys

Rich edit controls support the following shortcut keys.

Keys Operations Comments
Shift+Backspace Generate a LRM/LRM on a bidi keyboardBiDi specific
Ctrl+Tab Tab
Ctrl+Clear Select all
Ctrl+Number Pad 5 Select all
Ctrl+A Select all
Ctrl+E Center alignment
Ctrl+J Justify alignment
Ctrl+R Right alignment
Ctrl+L Left alignment
Ctrl+C Copy
Ctrl+V Paste
Ctrl+X Cut
Ctrl+Z Undo
Ctrl+Y Redo
Ctrl+'+' (Ctrl+Shift+'=') Superscript
Ctrl+'=' Subscript
Ctrl+1 Line spacing = 1 line.
Ctrl+2 Line spacing = 2 lines.
Ctrl+5 Line spacing = 1.5 lines.
Ctrl+' (apostrophe) Accent acuteAfter pressing the short cut key, press the appropriate letter (for example a, e, or u). This applies to English, French, German, Italian, and Spanish keyboards only.
Ctrl+` (grave) Accent graveSee Ctrl+' comments.
Ctrl+~ (tilde) Accent tildeSee Ctrl+' comments.
Ctrl+; (semicolon) Accent umlautSee Ctrl+' comments.
Ctrl+Shift+6 Accent caret (circumflex)See Ctrl+' comments.
Ctrl+, (comma) Accent cedillaSee Ctrl+' comments.
Ctrl+Shift+' (apostrophe) Activate smart quotes
Backspace If text is protected, beep and do not delete it. Otherwise, delete previous character.
Ctrl+Backspace Delete previous word. This generates a VK_F16 code.
F16 Same as Backspace.
Ctrl+Insert Copy
Shift+Insert Paste
Insert OverwriteDBCS (double-byte character set) does not overwrite.
Ctrl+Left Arrow Move cursor one word to the left.On bidi keyboard, this depends on the direction of the text.
Ctrl+Right Arrow Move cursor one word to the right.See Ctrl+Left Arrow comments.
Ctrl+Left Shift Left alignmentIn BiDi documents, this is for left-to-right reading order.
Ctrl+Right Shift Right alignmentIn BiDi documents, this is for right-to-left reading order.
Ctrl+Up Arrow Move to the line above.
Ctrl+Down Arrow Move to the line below.
Ctrl+Home Move to the beginning of the document.
Ctrl+End Move to the end of the document.
Ctrl+Page Up Move one page up.If in SystemEditMode and Single Line control, do nothing.
Ctrl+Page Down Move one page down.See Ctrl+Page Up comments.
Ctrl+Delete Delete the next word or selected characters.
Shift+Delete Cut the selected characters.
Esc Stop drag-drop.While doing a drag-drop of text.
Alt+Esc Change the active application.
Alt+X Converts the Unicode hexadecimal value preceding the insertion point to the corresponding Unicode character.
Alt+Shift+X Converts the Unicode character preceding the insertion point to the corresponding Unicode hexadecimal value.
Alt+0xxx (Number Pad) Inserts Unicode values if xxx is greater than 255. When xxx is less than 256, ASCI range text is inserted based on the current keyboard.Must enter decimal values.
Alt+Shift+Ctrl+F12 Hex to Unicode.In case Alt+X is already taken for another use.
Ctrl+Shift+A Set all caps.
Ctrl+Shift+L Change bullet style.