# RichEdit

This module allows you to create and programmatically set text properties in rich edit control. Besides that, it contains functions that work with standard edit controls. Each function contains description for which kind of control it can be used - any control supporting edit control interface (Edit, RichEdit, HiEdit...) or just rich edit control.

Summary

RichEdit | This module allows you to create and programmatically set text properties in rich edit control.
Add | Create rich edit version 4.1 control.
AutoUrlDetect | Enable, disable, or toggle automatic detection of URLs in the RichEdit control.
CanPaste | Determines whether an Edit control can paste a specified clipboard format.
CharFromPos | Gets information about the character closest to a specified point in the client area of the Edit control.
Clear | Send to an Edit control or combo box to delete (clear) the current selection.
Convert | Convert twips to pixels or vice-versa.
Copy | Copy selection of the Edit control.
Cut | Cut selection from the Edit control.
FindText | Find desired text in the Edit control.
FindWordBreak | Finds the next word break in rich edit conttrol, before or after the specified character position or retrieves information about the character at that position.
FixKeys | Fix Tab and Esc key handling in rich edit control.
GetLine | Get the text of the desired line from an Edit control.
GetLineCount | Gets the number of lines in a multiline Edit control.
GetOptions | Get the options for a rich edit control.
GetCharFormat | Determines the character formatting in a rich edit control.
GetRedo | Determine whether there are any actions in the rich edit control redo queue, and optionally retrieve the type of the next redo action.
GetModify | Gets the state of the modification flag for the Edit control.
GetParaFormat | Retrieves the paragraph formatting of the current selection in a rich edit control.
GetRect | Gets the formatting rectangle of the Edit control.
GetSel | Retrieve the starting and ending character positions of the selection in a rich edit control.
GetText | Retrieves a specified range of characters from a rich edit control.
GetTextLength | Calculates text length in various ways for a rich edit control.
GetUndo | Determine whether there are any actions in the Edit control undo queue, and optionally retrieve the type of the next undo action.
HideSelection | Hides or shows the selection in a rich edit control.
LineFromChar | Determines which line contains the specified character in a rich edit control.
LineIndex | Returns the character index of the first character of a specified line in an Edit control.
LineLength | Returns the length of a line in an Edit control.
LineScroll | Scrolls the text in the Edit control.
LimitText | Sets an upper limit to the amount of text the user can type or paste into a rich edit control.
Paste | Paste clipboard into the Edit control.
PasteSpecial | Pastes a specific clipboard format in a rich edit control.
PosFromChar | Gets the client area coordinates of a specified character in an Edit control.
Redo | Do redo operation.
ReplaceSel | Replace selection with desired text in the Edit control.
Save | Save the content of the rich edit control using RT format.
ScrollCaret | Scroll content of Edit control until caret is visible.
ScrollPos | Obtain the current scroll position, or tell the rich edit control to scroll to a particular point.
SelectionType | Determines the selection type for a rich edit control.
SetBgColor | Sets the background color for a rich edit control.
SetCharFormat | Set character formatting in a rich edit control.
SetEvents | Set notification events.
SetFontSize | Sets the font size for the selected text in the rich edit control.
SetModify | Sets or clears the modification flag for an edit control.
SetOptions | Sets the options for a rich edit control.
PageRotate | Rotate page.
SetParaFormat | Sets the paragraph formatting for the current selection in a rich edit control.
SetEditStyle | Sets the current edit style flags.
SetSel | Selects a range of characters or Component Object Model (COM) objects in a rich edit control.
SetText | Set text from string or file in rich edit control using either rich text or plain text.
SetUndoLimit | Set the maximum number of actions that can stored in the undo queue of the rich edit control.
ShowScrollBar | Shows or hides scroll bars for Edit control.
TextMode | Get or set the current text mode of a rich edit control.
WordWrap | Set word wrap mode in rich edit control.
Zoom | Sets the zoom ratio anywhere between 1/64 and 64.
Undo | Send message to Edit control to undo the next action in the control’s undo queue & optionally empty the undo buffer by resetting the undo flag.
About |

### Add

> RichEdit_Add( | HParent, |  |
> | X | = | "",
> | Y | = | "",
> | W | = | "",
> | H | = | "",
> | Style | = | "",
> | Text | = | "" | )

Create rich edit version 4.1 control. (requires at least Windows XP SP1)

#### Parameters

HParent | Handle of the parent of the control.
X..H | Position.
Style | White space separated list of control styles. Any integer style or one of the style keywords (see below). Invalid styles are skipped. “MULTILINE WANTRETURN VSCROLL” by default.
Text | Control text. Styles:
DISABLENOSCROLL | Disables scroll bars instead of hiding them when they are not needed.
BORDER | Displays the control with a sunken border style so that the rich edit control appears recessed into its parent window.
HIDDEN | Don’t show the control.
VSCROLL | Enble vertical scroll bar.
HSCROLL | Enable horizontal scroll bar. If this style is present control starts with wrap mode deactivated. Otherwise, wrap mode is active.
SCROLL | Enable both scroll bars.
AUTOHSCROLL | Automatically scrolls text to the right by 10 characters when the user types a character at the end of the line. When the user presses the ENTER key, the control scrolls all text back to position zero.
AUTOVSCROLL | Automatically scrolls text up one page when the user presses the ENTER key on the last line.
CENTER | Centers text in a single-line or multiline edit control.
LEFT | Left aligns text.
MULTILINE | Designates a multiline edit control. The default is single-line edit control.
NOHIDESEL | Negates the default behavior for an edit control. The default behavior hides the selection when the control loses the input focus and inverts the selection when the control receives the input focus. If you specify NOHIDESEL, the selected text is inverted, even if the control does not have the focus.
NUMBER | Allows only digits to be entered into the edit control.
PASSWORD | Displays an asterisk (*) for each character typed into the edit control. This style is valid only for single-line edit controls.
READONLY | Prevents the user from typing or editing text in the edit control.
RIGHT | Right aligns text in a single-line or multiline edit control.
SELECTIONBAR | When set, there is small left margin (wider than default) where cursor changes to right-up arrow allowing full line(s) selection. This style also requires use of MULTILINE style.
WANTRETURN | Specifies that a carriage return be inserted when the user presses the ENTER key while entering text into a multiline edit control in a dialog box. If you do not specify this style, pressing the ENTER key has the same effect as pressing the dialog box’s default push button. This style has no effect on a single-line edit control.

#### Returns

Control’s handle or 0. Error message on problem.

#### Example

>     Gui, +LastFound
>     hwnd := WinExist()
>     hRichEdit := RichEdit_Add(hwnd, 5, 5, 200, 300)
>     Gui, Show, w210 h310

### AutoUrlDetect

> RichEdit_AutoUrlDetect( | HCtrl, |  |
> | Flag | = | "" | )

Enable, disable, or toggle automatic detection of URLs in the RichEdit control.

#### Parameters

Flag | Specify true to enable automatic URL detection or false to disable it. Specify ”^” to toggle its current state. Omit to only return current state without any change.

#### Returns

If auto-URL detection is active, the return value is 1. If auto-URL detection is inactive, the return value is 0.

#### Example

>     MsgBox, % RichEdit_AutoUrlDetect( hRichEdit, true )
>     MsgBox, % RichEdit_AutoUrlDetect( hRichEdit, "^" )
>     MsgBox, % "Current state: " RichEdit_AutoUrlDetect( hRichEdit )

### CanPaste

> RichEdit_CanPaste( | hEdit, |  |
> | ClipboardFormat | = | 0x1 | )

Determines whether an Edit control can paste a specified clipboard format.

#### Parameters

ClipboardFormat | Specifies the Clipboard Formats to try. To try any format currently on the clipboard, set this parameter to zero. The default is 0x1 (CF_TEXT).

#### Returns

True if the clipboard format can be pasted otherwise false.

#### Remarks

For additional information on clipboard formats, see the following: http://msdn.microsoft.com/en-us/library/ms649013(VS.85).aspx

#### Related

Paste, PasteSpecial

#### Example

>     If RichEdit_CanPaste( hRichEdit, 0 )
>       RichEdit_Paste( hRichEdit )
>     Else
>       MsgBox, Cannot paste your clipboard into control..

### CharFromPos

> RichEdit_CharFromPos( | hEdit,
> | X,
> | Y | )

Gets information about the character closest to a specified point in the client area of the Edit control.

#### Parameters

X, Y | The coordinates of a point in the Edit control’s client area relative to the upper-left corner of the client area.

#### Returns

The character index of the specified point or the character index to the last character if the given point is beyond the last character in the control.

### Clear

> RichEdit_Clear( | hEdit | )

Send to an Edit control or combo box to delete (clear) the current selection.

#### Remarks

To delete the current selection and place the deleted content on the clipboard, use the Cut operation.

#### Related

Cut, Copy, Paste

### Convert

> RichEdit_Convert( | Input, |
> | Direction | = | )

Convert twips to pixels or vice-versa.

#### Parameters

Input | Twips (Input>0) or pixels (Input<0).
Direction | 0 (default) or 1. Pixels are not always square (the height and width are not the same). Therefore, it is necessary to pass in the desired “direction” to use, horizontal (0) or vertical (1). Returns: Rounded value.

### Copy

> RichEdit_Copy( | hEdit | )

Copy selection of the Edit control.

#### Related

Cut, Clear, Paste

### Cut

> RichEdit_Cut( | hEdit | )

Cut selection from the Edit control.

#### Related

Copy, Clear, Paste

### FindText

> RichEdit_FindText( | hEdit, |  |
> | Text, |  |
> | CpMin | = | 0,
> | CpMax | = | -1,
> | Flags | = | "UNICODE" | )

Find desired text in the Edit control.

#### Parameters

Text | Text to be searched for.
CpMin | Start searching at this character position. By default 0.
CpMax | End searching at this character position. When searching forward, a value of –1 extends the search range to the end of the text.
Flags | Space separated combination of search flags. See below.

#### Flags

WHOLEWORD | If set, the operation searches only for whole words that match the search string. If not set, the operation also searches for word fragments that match the search string.
MATCHCASE | If set, the search operation is case-sensitive. If not set, the search operation is case-insensitive.
DOWN | Rich Edit only: If set, the search is from the end of the current selection to the end of the document. If not set, the search is from the end of the current selection to the beginning of the document.
UNICODE | Transforms Text into the Unicode charset before searching for it. Returns: The zero-based character position of the next match, or -1 if there are no more matches.

Remarks The CpMin member always specifies the starting-point of the search, and CpMax specifies the end point. When searching backward, CpMin must be equal to or greater than CpMax.

#### Example

>     ^f::
>       RichEdit_HideSelection( hRichEdit, false )
>       Dlg_Find( hwnd, "OnFind", "d" )
>     return

>     OnFind(Event, Flags, FindText, ReplaceText)  {
>       global hRichEdit

>       IfNotEqual, Event, F,  return
>       RichEdit_GetSel(hRichEdit, min, max)
>       word := InStr(Flags,"w") ? " WHOLEWORD" : ""
>       case := InStr(Flags,"c") ? " MATCHCASE" : ""
>       InStr( Flags, "d" ) ? (pos:=max+1 , direction:=" DOWN")
>                           : (pos:=max-1)

>       ; search control for word
>       pos:=RichEdit_FindText(hRichEdit,FindText,pos,-1,"unicode" direction word case)

>       ; highlight found match
>       if pos != -1
>           RichEdit_SetSel(hRichEdit, pos, pos+StrLen(FindText))

>       Else
>         MsgBox, no matches found..
>     }
>     return

### FindWordBreak

> RichEdit_FindWordBreak( | hCtrl, |  |
> | CharIndex, |  |
> | Flag | = | "" | )

Finds the next word break in rich edit conttrol, before or after the specified character position or retrieves information about the character at that position.

#### Parameters

CharIndex | Zero-based character starting position.
Flag | One of the flags list below.

#### Flag

CLASSIFY | Returns the character class and word-break flags of the character at the specified position.
ISDELIMITER | Returns true if the character at the specified position is a delimiter, or false otherwise.
LEFT | Finds the nearest character before the specified position that begins a word.
LEFTBREAK | Finds the next word end before the specified position. This value is the same as PREVBREAK.
MOVEWORDLEFT | Finds the next character that begins a word before the specified position. This value is used during CTRL+LEFT ARROW key processing.
MOVEWORDRIGHT | Finds the next character that begins a word after the specified position. This value is used during CTRL+right key processing.
RIGHT | Finds the next character that begins a word after the specified position.
RIGHTBREAK | Finds the next end-of-word delimiter after the specified position. This value is the same as NEXTBREAK.

#### Returns

The message returns a value based on the wParam parameter.

- CLASSIFY - Returns the character class and word-break flags of the character at the specified position.
- ISDELIMITER - Returns true if the character at the specified position is a delimiter, otherwise it returns false.
- Other - Returns the character index of the word break.

### FixKeys

> RichEdit_FixKeys( | hCtrl | )

Fix Tab and Esc key handling in rich edit control.

#### Returns

True or false.

#### Remarks

Whenever you press Escape in a multiline edit control it sends a WM_CLOSE message to its parent. Both the regular edit control and the rich edit control have this problem. This is by Microsoft design. There is also similar undesired behavior for {Tab} key which is used by the system to navigate over controls with “tabstop” flag. RichEdit is designed to use ^{Tab} instead. This function subclasses the control to prevent such behavior.

However, before using this function be sure to know what subclassing is and what kind of effects it may introduce to your particular script. There is also other method to solve this problem via hotkey handling while rich edit control has focus.

#### Reference

- WM_GETDLGCODE @ MSDN: http://msdn.microsoft.com/en-us/library/ms645425(VS.85).aspx
- William Willing blog: http://www.williamwilling.com/blog/?p=28.
- WinAsm Forum: http://www.winasm.net/forum/index.php?showtopic=487.
- CodeGuru: http://www.codeguru.com/cpp/controls/editctrl/keyboard/article.php/c513/.
- Strange Microsoft solution for VB (that doesn’t work): http://support.microsoft.com/kb/q143273/.

### GetLine

> RichEdit_GetLine( | hEdit, |  |
> | LineNumber | = | -1 | )

Get the text of the desired line from an Edit control.

#### Parameters

LineNumber | Zero-based index of the line. -1 means current line.

#### Returns

The return value is the text. The return value is empty string if the line number specified by the line parameter is greater than the number of lines in the Edit control.

#### Related

GetText, LineIndex, LineLength

### GetLineCount

> RichEdit_GetLineCount( | hEdit | )

Gets the number of lines in a multiline Edit control.

#### Returns

The return value is an integer specifying the total number of text lines in the multiline edit control or rich edit control. If the control has no text, the return value is 1. The return value will never be less than 1.

#### Remarks

The function retrieves the total number of text lines, not just the number of lines that are currently visible. If the Wordwrap feature is enabled, the number of lines can change when the dimensions of the editing window change.

#### Related

GetTextLength, LineLength

### GetOptions

> RichEdit_GetOptions( | hCtrl | )

Get the options for a rich edit control.

#### Remarks

See SetOptions for details.

### GetCharFormat

> RichEdit_GetCharFormat( |  | hCtrl, |  |
> | ByRef | Face | = | "",
> | ByRef | Style | = | "",
> | ByRef | TextColor | = | "",
> | ByRef | BackColor | = | "",
> |  | Mode | = | "SELECTION" | )

Determines the character formatting in a rich edit control.

#### Parameters

Face | Optional byref parameter will contain the name of the font.
Style | Optional byref parameter will contain a space separated list of styles. See SetCharFormat for list of styles.
TextColor | Text forground color. If starts with “-” the color is AUTOCOLOR.
BackColor | Text background color. If starts with “-” the color is AUTOCOLOR.
Mode | If empty, this optional parameter retrieves the formatting to all text in the control. Otherwise, pass “SELECTION” (default) to get formatting of the current selection. If the selection is empty, the function will get the character of the insertion point.

#### Remarks

Function will get the attributes of the first character.

#### Related

SetCharFormat, SetBgColor

#### Example

>     RichEdit_GetCharFormat(hRichEdit, face, style, color)
>     MsgBox, Face = %Face% `nstyle = %style%  `ncolor = %color%

### GetRedo

> RichEdit_GetRedo( |  | hCtrl, |  |
> | ByRef | name | = | "-" | )

Determine whether there are any actions in the rich edit control redo queue, and optionally retrieve the type of the next redo action.

#### Parameters

name | This optional parameter is the name of the variable in which to store the type of redo action, if any.

#### Name Types

UNKNOWN | The type of undo action is unknown.
TYPING | Typing operation.
DELETE | Delete operation.
DRAGDROP | Drag-and-drop operation.
CUT | Cut operation.
PASTE | Paste operation.

#### Returns

If there are actions in the control redo queue, the return value is a nonzero value. If the redo queue is empty, the return value is zero.

#### Related

Redo, GetUndo, Undo, SetUndoLimit

#### Example

>     If RichEdit_GetRedo( hRichEdit, name )
>       MsgBox, The next redo is a %name% type
>     Else
>       MsgBox, Nothing left to redo.

### GetModify

> RichEdit_GetModify( | hEdit | )

Gets the state of the modification flag for the Edit control. The flag indicates whether the contents of the control has been modified.

#### Returns

True if the content of Edit control has been modified, false otherwise.

#### Related

SetModify, Save

### GetParaFormat

Retrieves the paragraph formatting of the current selection in a rich edit control. (*** not implemented ***)

### GetRect

> RichEdit_GetRect( |  | hEdit, |  |
> | ByRef | Left | = | "",
> | ByRef | Top | = | "",
> | ByRef | Right | = | "",
> | ByRef | Bottom | = | "" | )

Gets the formatting rectangle of the Edit control.

#### Parameters

Left..Bottom | Output variables, can be omitted.

#### Returns

Space separated rectangle.

### GetSel

> RichEdit_GetSel( |  | hCtrl, |  |
> | ByRef | cpMin | = | "",
> | ByRef | cpMax | = | "" | )

Retrieve the starting and ending character positions of the selection in a rich edit control.

#### Parameters

cpMin | The optional name of the variable in which to store the character position index immediately preceding the first character in the range.
cpMin | The optional name of the variable in which to store the character position index immediately following the last character in the range.

#### Returns

Returns cpMin. If there is no selection this is cursor position.

#### Related

GetText, GetTextLength, SetSel, SetText, HideSelection, LineFromChar

### GetText

> RichEdit_GetText( | HCtrl, |  |
> | CpMin | = | "-",
> | CpMax | = | "-",
> | CodePage | = | "" | )

Retrieves a specified range of characters from a rich edit control.

#### Parameters

CpMin | Beginning of range of characters to retrieve.
CpMax | End of range of characters to retrieve.
CodePage | If UNICODE or U, this optional parameter will use unicode code page in the translation. Otherwise it will default to using ansi. (*** needs rework ***)

#### Note

If the CpMin and CpMax are omitted, the current selection is retrieved. The range includes everything if CpMin is 0 and CpMax is –1.

#### Returns

Returns the retrieved text.

#### Related

GetSel, GetLine, GetTextLength, SetText, SetSel, FindText

#### Example

>     MsgBox, % RichEdit_GetText( hRichEdit ) ; get current selection
>     MsgBox, % RichEdit_GetText( hRichEdit, 0, -1 ) ; get all
>     MsgBox, % RichEdit_GetText( hRichEdit, 4, 10 ) ; get range

### GetTextLength

> RichEdit_GetTextLength( | hCtrl, |  |
> | Flags | = | 0,
> | CodePage | = | "" | )

Calculates text length in various ways for a rich edit control.

#### Parameters

flag | Space separated list of one or more options. See below list.
codepage | If UNICODE or U, this optional parameter will use unicode code page in the translation. Otherwise it will default to using ansi.

#### Flag Options

DEFAULT | Returns the number of characters. This is the default.
USECRLF | Computes the answer by using CR/LFs at the end of paragraphs.
PRECISE | Computes a precise answer. This approach could necessitate a conversion and thereby take longer. This flag cannot be used with the CLOSE flag.
CLOSE | Computes an approximate (close) answer. It is obtained quickly and can be used to set the buffer size. This flag cannot be used with the PRECISE flag.
NUMCHARS | Returns the number of characters. This flag cannot be used with the NUMBYTES flag.
NUMBYTES | Returns the number of bytes. This flag cannot be used with the NUMCHARS flag.

#### Returns

If the operation succeeds, the return value is the number of TCHARs in the edit control, depending on the setting of the flags. If the operation fails, the return value is blank.

#### Remarks

This message is a fast and easy way to determine the number of characters in the Unicode version of the rich edit control. However, for a non-Unicode target code page you will potentially be converting to a combination of single-byte and double-byte characters.

#### Related

LineLength, LimitText, GetSel

#### Example

>     MsgBox, % "DEFAULT  = " RichEdit_GetTextLength(hRichEdit, "DEFAULT" )  "`n"
>             . "USECRLF  = " RichEdit_GetTextLength(hRichEdit, "USECRLF" )  "`n"
>             . "PRECISE  = " RichEdit_GetTextLength(hRichEdit, "PRECISE" )  "`n"
>             . "CLOSE    = " RichEdit_GetTextLength(hRichEdit, "CLOSE" )    "`n"
>             . "NUMCHARS = " RichEdit_GetTextLength(hRichEdit, "NUMCHARS" ) "`n"
>             . "NUMBYTES = " RichEdit_GetTextLength(hRichEdit, "NUMBYTES" ) "`n"

### GetUndo

> RichEdit_GetUndo( |  | hCtrl, |  |
> | ByRef | Name | = | "-" | )

Determine whether there are any actions in the Edit control undo queue, and optionally retrieve the type of the next undo action.

#### Parameters

Name | Optional byref parameter will contain the type of undo action, if any.

#### Types

UNKNOWN | The type of undo action is unknown.
TYPING | Typing operation.
DELETE | Delete operation.
DRAGDROP | Drag-and-drop operation.
CUT | Cut operation.
PASTE | Paste operation.

#### Returns

If there are actions in the control undo queue, the return value is a nonzero value. If the undo queue is empty, the return value is zero.

#### Related

Undo, SetUndoLimit, GetRedo, Redo

#### Example

>     If RichEdit_GetRedo( hRichEdit, name )
>       MsgBox, The next redo is a %name% type
>     Else MsgBox, Nothing left to redo.

### HideSelection

> RichEdit_HideSelection( | hCtrl, |  |
> | State | = | true | )

Hides or shows the selection in a rich edit control.

#### Parameters

State | True or false.

#### Remarks

This function is noticeable when it is set to false and the rich edit control isn’t the active control or window. The example included in FindText demonstrates use.

#### Related

SetSel, GetSel

### LineFromChar

> RichEdit_LineFromChar( | hCtrl, |  |
> | CharIndex | = | -1 | )

Determines which line contains the specified character in a rich edit control.

#### Parameters

CharIndex | Zero-based integer index of the character. -1 (default) means current line.

#### Returns

Zero-based index of the line.

#### Related

LineIndex, GetLineCount

### LineIndex

> RichEdit_LineIndex( | hEdit, |  |
> | LineNumber | = | -1 | )

Returns the character index of the first character of a specified line in an Edit control.

#### Parameters

LineNumber | Line number for which to retreive character index. -1 (default) means current line.

#### Returns

The character index of the line specified, or -1 if the specified line number is greater than the number of lines.

#### Related

LineLength, LineFromChar, GetLine, GetLineCount

### LineLength

> RichEdit_LineLength( | hEdit, |  |
> | LineNumber | = | -1 | )

Returns the length of a line in an Edit control.

#### Parameters

LineNumber | Line number for which to retreive line length. -1 (default) means current line.

#### Returns

The length (in characters) of the line.

#### Related

GetTextLength, LineIndex, LineFromChar

### LineScroll

> RichEdit_LineScroll( | hEdit, |  |
> | XScroll | = | 0,
> | YScroll | = | 0 | )

Scrolls the text in the Edit control.

#### Parameters

XScroll | The number of characters to scroll horizontally. Use a negative number to scroll to the left and a positive number to scroll to the right.
YScroll | The number of lines to scroll vertically. Use a negative number to scroll up and a positive number to scroll down. Remarks: This message does not move the caret. This function can be used to scroll horizontally past the last character of any line.

### LimitText

> RichEdit_LimitText( | hCtrl, |
> | txtSize | = | )

Sets an upper limit to the amount of text the user can type or paste into a rich edit control.

#### Parameters

txtSize | Specifies the maximum amount of text that can be entered. If this parameter is zero, the default maximum is used, which is 64K characters. A Component Object Model (COM) object counts as a single character.

#### Returns

This function does not return a value.

#### Remarks

Before LimitText is called, the default limit to the amount of text a user can enter is 32,767 characters.

### Paste

> RichEdit_Paste( | hEdit | )

Paste clipboard into the Edit control.

#### Related

CanPaste, PasteSpecial, Cut, Copy, Clear

### PasteSpecial

> RichEdit_PasteSpecial( | HCtrl,
> | Format | )

Pastes a specific clipboard format in a rich edit control.

#### Parameters

Format | One of the clipboard formats. See http://msdn.microsoft.com/en-us/library/bb774214(VS.85).aspx

#### Related

CanPaste, Paste

### PosFromChar

> RichEdit_PosFromChar( |  | hEdit,
> |  | CharIndex,
> | ByRef | X,
> | ByRef | Y | )

Gets the client area coordinates of a specified character in an Edit control.

#### Parameters

CharIndex | The zero-based index of the character.
X, Y | These parameters, which must contain valid variable names, are used to return the x/y-coordinates of a point in the control’s client relative to the upper-left corner of the client area.

#### Remarks

If CharIndex is greater than the index of the last character in the control, the returned coordinates are of the position just past the last character of the control.

### Redo

> RichEdit_Redo( | hEdit | )

Do redo operation.

#### Returns

True if the Redo operation succeeds, false otherwise.

### ReplaceSel

> RichEdit_ReplaceSel( | hEdit, |  |
> | Text | = | "" | )

Replace selection with desired text in the Edit control.

#### Parameters

Text | Text to replace selection with.

### Save

> RichEdit_Save( | hCtrl, |  |
> | FileName | = | "" | )

Save the content of the rich edit control using RT format.

#### Parameters

FileName | File name to save RTF file to. If omitted, function will return content.

#### Related

GetModify, SetModify

#### Example

>     If !RichEdit_GetModify( hRichEdit )  {
>       MsgBox, No changes detected
>       return
>     }

>     RichEdit_Save( hRichEdit, file )
>     RichEdit_SetModify( hRichEdit, false )
>     MsgBox, File has been saved

### ScrollCaret

> RichEdit_ScrollCaret( | hEdit | )

Scroll content of Edit control until caret is visible.

### ScrollPos

> RichEdit_ScrollPos( | HCtrl, |  |
> | PosString | = | "" | )

Obtain the current scroll position, or tell the rich edit control to scroll to a particular point.

#### Parameters

PosString | String specifying the x/y point in the virtual text space of the document, expressed in pixels. (See example)

#### Returns

If posString is omitted, the return value is the current scroll position.

#### Related

ShowScrollBar, GetSel, LineFromChar, SetSel

#### Example

>     Msgbox, % "scroll pos = " RichRichEdit_ScrollPos( hRichEdit )
>     RichRichEdit_ScrollPos( hRichEdit , "7/22" )

### SelectionType

> RichEdit_SelectionType( | hCtrl | )

Determines the selection type for a rich edit control.

#### Returns

If the selection is not empty, the return value is a set of flags containing one or more of the following values: TEXT - Text. OBJECT - At least one Component Object Model (COM) object. MULTICHAR - More than one character of text. MULTIOBJECT - More than one COM object.

#### Remarks

This message is useful during WM_SIZE processing for the parent of a bottomless rich edit control.

### SetBgColor

> RichEdit_SetBgColor( | hCtrl,
> | Color | )

Sets the background color for a rich edit control.

#### Parameters

Color | Color in RGB format (0xRRGGBB) if > 0 or BGR format if < 0.

#### Returns

Returns the previous background color in RGB format.

#### Related

SetCharFormat, GetCharFormat

#### Example

>     Dlg_Color( color, hRichEdit )
>     RichEdit_SetBgColor( hRichEdit, color )

>     RichEdit_SetBgColor( hRichEdit, 0xa9f874 )

### SetCharFormat

> RichEdit_SetCharFormat( | HCtrl, |  |
> | Face | = | "",
> | Style | = | "",
> | TextColor | = | "",
> | BackColor | = | "",
> | Mode | = | "SELECTION" | )

Set character formatting in a rich edit control.

#### Parameters

Face | Font name. Optional.
Style | Space separated list of styles. See below list. Optional.
TextColor | Text foreground color. Optional.
BackColor | Text backgrond color. Optional.
Mode | Character formatting that applies to the control. If omitted, the function changes the default character formatting. It can be one of the values given bellow. Optional.

#### Styles

s<Num> | Character size, usual AHK represntation (i.e. s12)
o<Num> | Character offset from the baseline, in twips,. If the value of this member is positive, the character is a superscript; if the value is negative, the character is a subscript.
AUTOBACKCOLOR | The background color is the return value of GetSysColor(COLOR_WINDOW:=5). If this flag is set, BackColor member is ignored.
AUTOCOLOR | The text color is the return value of GetSysColor(COLOR_WINDOWTEXT:=8). If this flag is set, the TextColor member is ignored.
BOLD | Characters are bold.
HIDDEN | Characters are not displayed.
ITALIC | Characters are italic.
LINK | A rich edit control sends LINK notification messages when it receives mouse messages while the mouse pointer is over text with the LINK effect.
PROTECTED | Characters are protected; an attempt to modify them will cause an PROTECTED notification message.
STRIKEOUT | Characters are struck out.
SUBSCRIPT | Characters are subscript. The SUPERSCRIPT and SUBSCRIPT values are mutually exclusive. For both values, the control automatically calculates an offset and a smaller font size.
SUPERSCRIPT | Characters are superscript.
UNDERLINE | Characters are underlined.

#### Modes

DEFAULT | Changes the formating for the default text in the control. This is also the style used if you don’t specify valid style.
ALL | Applies the formatting to all text in the control.
SELECTION | Applies the formatting to the current selection. If the selection is empty, the character formatting is applied to the insertion point, and the new character format is in effect only until the insertion point changes.
WORD | Applies the formatting to the selected word or words. If the selection is empty but the insertion point is inside a word ,the formatting is applied to the word.

#### Returns

True or false.

#### Remarks

This function will fire up SELCHANGE message even if selection isn’t changed.

### SetEvents

> RichEdit_SetEvents( | hCtrl, |  |
> | Handler | = | "",
> | Events | = | "selchange" | )

Set notification events.

#### Parameters

Handler | Function that handles events. If empty, any existing handler will be removed.
Events | White space separated list of events to monitor.

#### Handler

>     Result := Handler(hCtrl, Event, p1, p2, p3 )

hCtrl | Handle of richedit control sending the event.
Event | Specifies event that occurred. Event must be registered to be able to monitor it.
Col,Row | Cell coordinates.
Data | Numeric data of the cell. Pointer to string for textual cells and DWORD value for numeric.
Result | Return 1 to prevent action.

#### Events

CHANGE: Sent when the user has taken an action that may have altered text in an edit control. Sent after the system updates the screen. (***)

DRAGDROPDONE: Notifies a rich edit control’s parent window that the drag-and-drop operation has completed.

- P1 - Number of characters highlighted in drag-drop operation.
- P2 - Beginning character position of range.
- P3 - Ending character position of range.

DROPFILES: Notifies that the user is attempting to drop files into the control.

- P1 - Number of files dropped onto rich edit control.
- P2 - Newline delimited (`n) list of files dropped onto control.
- P3 - Character position files were dropped onto within rich edit control.

KEYEVENTS: Notification of a keyboard or mouse event in the control. To ignore the event, the handler function should return a nonzero value. (*** needs redone)

- P1 - Character position files were dropped onto within rich edit control.

MOUSEEVENTS,SCROLLEVENTS,LINK: A rich edit control sends these messages when it receives various messages, when the user clicks the mouse or when the mouse pointer is over text that has the LINK effect. (*** expand usefulness)

PROTECTED: User is taking an action that would change a protected range of text. To ignore the event, the handler function should return a nonzero value.

REQUESTRESIZE: This message notifies a rich edit control’s parent window that the control’s contents are either smaller or larger than the control’s window size.

- P1 - Requested new size.

SELCHANGE: The current selection has changed.

- P1 - Beginning character position of range.
- P2 - Ending character position of range.
- P3 - Selection type.

LINK: The hyperlink has been clicked.

- P1 - LClick or RClick.
- P2 - CpMin.
- P3 - CpMax.

#### Returns

The previous event mask (number).

### SetFontSize

> RichEdit_SetFontSize( | hCtrl,
> | Add | )

Sets the font size for the selected text in the rich edit control.

#### Parameters

Add | Change in point size of the selected text. The change is applied to each part of the selection. So, if some of the text is 10pt and some 20pt, after a call with wParam set to 1, the font sizes become 11pt and 22pt, respectively.

#### Returns

True if no error occurred, false otherwise.

### SetModify

> RichEdit_SetModify( | hEdit, |  |
> | State | = | true | )

Sets or clears the modification flag for an edit control. The modification flag indicates whether the text within the edit control has been modified.

#### Related

GetModify, Save

### SetOptions

> RichEdit_SetOptions( | hCtrl,
> | Operation,
> | Options | )

Sets the options for a rich edit control.

#### Parameters

Operation | Specifies the operation.
Options | White separted list of option values.

#### Operation

SET | Sets the options to those specified by Options.
OR | Combines the specified options with the current options.
AND | Retains only those current options that are also specified by Options.
XOR | Logically exclusive OR the current options with those specified by Options.

#### Options

AUTOWORDSELECTION | Automatic selection of word on double-click.
AUTOVSCROLL | Same as AUTOVSCROLL style.
AUTOHSCROLL | Same as AUTOHSCROLL style.
NOHIDESEL | Same as NOHIDESEL style.
READONLY | Same as READONLY style.
WANTRETURN | Same as WANTRETURN style.
SELECTIONBAR | Same as SELECTIONBAR style. Returns: Returns the current options of the edit control.

### PageRotate

> RichEdit_PageRotate( | hCtrl, |  |
> | R | = | "" | )

Rotate page.

#### Parameters

R | Can be one of the following: 0,90,180,270.

#### Returns

If R is omitted, functin returns current rotation.

### SetParaFormat

> RichEdit_SetParaFormat( | hCtrl, |  |
> | o1 | = | "",
> | o2 | = | "",
> | o3 | = | "",
> | o4 | = | "",
> | o5 | = | "",
> | o6 | = | "" | )

Sets the paragraph formatting for the current selection in a rich edit control.

#### Parameters

o1..o6 | Named arguments: Num, Align, Line, Ident, Space, Tabs. Each named arugment has its own set of parameters (delimited by comma). The syntax is “Name=a1,a2,a3,a4”.

Num :

Type | EMPTY, BULLET, DECIMAL, LOWER, UPPER, ROMAN_LOWER, ROMAN_UPPER, SEQUENCE (Uses a sequence of characters beginning with the character specified by the start argument).
Start | Starting number or starting value used for numbered paragraphs.
Style | One of the following :

- RP - Follows the number with a right parenthesis.
- P - Encloses the number in parentheses.
- D - Follows the number with a dot.
- N - Displays only the number.
- CONT - Continues a numbered list without applying the next number or bullet.
- NEW - Starts a new number with value of Start parameter.

Offset | Minimum space between a paragraph number and the paragraph text, in twips.

Align :

Type | CENTER, LEFT, RIGHT, JUSTIFY.

Line :

Rule | One of the following :

- SINGLE - Single spacing.
- 1ANDHALF - One-and-a-half spacing.
- DOUBLE - Double spacing.
- S1 - The Spacing specifies the spacing from one line to the next, in twips. However, if Spacing specifies a value that is less than single spacing, the control displays single-spaced text.
- S2 - The Spacing specifies the spacing from one line to the next, in twips. The control uses the exact spacing specified, even if Spacing specifies a value that is less than single spacing.
- S3 - The value of Spacing/20 is the spacing, in lines, from one line to the next. Thus, setting Spacing to 20 produces single-spaced text, 40 is double spaced, 60 is triple spaced, and so on.

Spacing | Spacing between lines. This value is valid only for S1-S3 Rules.

Ident :

First | Indentation of the paragraph’s first line, relative to the paragraph’s current indentation, in twips. The indentation of subsequent lines depends on the Offset member. To see all this in effect you must enable word wrap mode. If starts with “.”, it represents absolute indentation from the left margin.
Offset | Indentation of the second and subsequent lines, relative to the indentation of the first line, in twips. The first line is indented if this member is negative or outdented if this member is positive.
Right | Indentation of the right side of the paragraph, relative to the right margin, in twips.

Space :

Before | Size of the spacing above the paragraph, in twips.
After | Specifies the size of the spacing below the paragraph, in twips.

Tabs :

List | Space separated list of absolute tab stop positions in twips.

#### Returns

True if succeessiful, false otherwise.

#### Remarks

Control uses carriage return character (`r) for paragraph markers by default.

### SetEditStyle

> RichEdit_SetEditStyle( | hCtrl,
> | Style | )

Sets the current edit style flags.

#### Parameters

Style | One of the styles bellow. Prepend “-” to turn the style off.

#### Styles

EMULATESYSEDIT | When this bit is on, rich edit attempts to emulate the system edit control.
BEEPONMAXTEXT | Rich Edit will call the system beeper if the user attempts to enter more than the maximum characters.
EXTENDBACKCOLOR | Extends the background color all the way to the edges of the client rectangle.
USEAIMM | Uses the AIMM input method component that ships with Microsoft Internet Explorer 4.0 or later.
UPPERCASE | Converts all input characters to uppercase.
LOWERCASE | Converts all input characters to lowercase.
XLTCRCRLFTOCR | Turns on translation of CRCRLFs to CRs. When this bit is on and a file is read in, all instances of CRCRLF will be converted to hard CRs internally. This will affect the text wrapping. Note that if such a file is saved as plain text, the CRs will be replaced by CRLFs. This is the .txt standard for plain text.
SCROLLONKILLFOCUS | When KillFocus occurs, scroll to the beginning of the text.

#### Returns

State of the edit style flags after rich edit has attempted to implement your edit style changes (number).

### SetSel

> RichEdit_SetSel( | hCtrl, |  |
> | CpMin | = | 0,
> | CpMax | = | 0 | )

Selects a range of characters or Component Object Model (COM) objects in a rich edit control.

#### Parameters

CpMin | Beginning of range of characters to select.
CpMax | End of range of characters to select.

#### Remarks

If the cpMin and cpMax members are equal, or cpMax is omitted, the cursor will be moved to cpMin’s position. The range includes everything if cpMin is 0 and cpMax is –1.

#### Returns

The selection that is actually set.

#### Related

HideSelection, SetText, GetSel, GetText, GetTextLength

#### Example

>     RichEdit_SetSel( hRichEdit, 4, 10 ) ; select range
>     RichEdit_SetSel( hRichEdit, 2 )     ; move cursor to right of 2nd character
>     RichEdit_SetSel( hRichEdit, 0, -1 ) ; select all

### SetText

> RichEdit_SetText( | HCtrl, |  |
> | Txt | = | "",
> | Flag | = | 0,
> | Pos | = | "" | )

Set text from string or file in rich edit control using either rich text or plain text.

#### Parameters

Txt | The text string to set within control. To set RTF mark-up the Txt must be prefixed with “{rtf”.
Flag | Space separated list of options. See below list.
Pos | This optional parameter allows you to specify a character position you want text inserted to, rather than replacing current selection. To append to the end, use -1. When using SELECTION flag, the position is relative to the current selection text and current selection is expanded to contain new text. If used without SELECTION flag existing selection remains unafected.

#### Flags

DEFAULT | Deletes the undo stack, discards rich-text formatting, & replaces all text.
KEEPUNDO | Keeps the undo stack.
SELECTION | Replaces selection and keeps rich-text formatting. If you don’t specify this style entire content of the control will be replaced with the new text.
FROMFILE | Load a file into control. If used, this option expects the txt parameter to be a filename. If there is a problem loading the file, ErrorLevel will contain message.

#### Returns

If the operation is setting all of the text and succeeds, the return value is 1. If the operation fails, the return value is zero.

#### Related

SetSel, GetText, GetSel, TextMode

#### Example

>     FileSelectFile, file,,, Select file, RTF(*.rtf; *.txt)
>     RichEdit_SetText(hRichEdit, file, "FROMFILE KEEPUNDO")

>     RichEdit_SetText(hRichEdit, "insert..", "SELECTION")

>     RichEdit_SetText(hRichEdit, "replace all..")

>     RichEdit_SetText(hRichEdit, "append to end of selection..", "SELECTION", -1 )

### SetUndoLimit

> RichEdit_SetUndoLimit( | hCtrl,
> | nMax | )

Set the maximum number of actions that can stored in the undo queue of the rich edit control.

#### Parameters

nMax | The maximum number of actions that can be stored in the undo queue.

#### Returns

The return value is the new maximum number of undo actions for the rich edit control.

#### Remarks

By default, the maximum number of actions in the undo queue is 100. If you increase this number, there must be enough available memory to accommodate the new number. For better performance, set the limit to the smallest possible value needed.

#### Related

Undo, GetUndo, Redo, GetRedo

#### Example

>     MsgBox, % RichEdit_SetUndoLimit( hRichEdit, 5 )

### ShowScrollBar

> RichEdit_ShowScrollBar( | hCtrl, |  |
> | Bar, |  |
> | State | = | true | )

Shows or hides scroll bars for Edit control.

#### Parameters

Bar | Identifies which scroll bar to display: horizontal or vertical. This parameter must be “V”, “H”, or a combination of the two.
State | True or false.

#### Remarks

This method is only valid when the control is in-place active. Calls made while the control is inactive may fail.

#### Related

ScrollPos

#### Example

>     RichEdit_ShowScrollBar( hRichEdit, "VH", false )
>     Sleep, 3000

>     RichEdit_ShowScrollBar( hRichEdit, "V", true )

### TextMode

> RichEdit_TextMode( | HCtrl, |  |
> | TextMode | = | "" | )

Get or set the current text mode of a rich edit control.

#### Parameters

TextMode | Space separated list of options (see below). If omitted, current text mode is returned.

#### Options

Specify one of the following values to set the text mode parameter. If you don’t specify a text mode value, the text mode remains at its current setting.

PLAINTEXT | Indicates plain-text mode, in which the control is similar to a standard edit control.
RICHTEXT | Indicates rich-text mode (default text mode).

Specify one of the following values to set the undo level parameter. If you don’t specify an undo level value, the undo level remains at its current setting.

SINGLELEVELUNDO | The control allows the user to undo only the last action in the undo queue.
MULTILEVELUNDO | The control supports multiple undo actions (default undo mode). Use SetUndoLimit to set the maximum number of undo actions.

Specify one of the following values to set the code page parameter. If you don’t specify an code page value, the code page remains at its current setting.

SINGLECODEPAGE | The control only allows the English keyboard and a keyboard corresponding to the default character set. For example, you could have Greek and English. Note that this prevents Unicode text from entering the control. For example, use this value if a rich edit control must be restricted to ANSI text.
MULTICODEPAGE | The control allows multiple code pages and Unicode text into the control (default code page mode).

#### Returns

If TextMode is omitted, the return value is the current text mode settings. When TextMode is given, function will return true or false.

#### Remarks

The control text will be deleted when calling this function.

In rich text mode, a rich edit control has standard rich edit functionality. However, in plain text mode, the control is similar to a standard edit control :

- The text in a plain text control can have only one format (such as Bold, 10pt Arial).
- The user cannot paste rich text formats, such as Rich Text Format (RTF) or embedded objects into a plain text control.
- Rich text mode controls always have a default end-of-document marker or carriage return, to format paragraphs.
- Plain text controls, on the other hand, do not need the default, end-of-document marker, so it is omitted.

#### Related

SetUndoLimit

#### Example

>     MsgBox, % "mode= " RichEdit_TextMode(hRichEdit)

>     If RichEdit_TextMode( hRichEdit, "PLAINTEXT SINGLELEVELUNDO" )
>           MsgBox, % "new mode= " RichEdit_TextMode(hRichEdit)
>     Else  MsgBox, % errorlevel

### WordWrap

> RichEdit_WordWrap( | HCtrl,
> | Flag | )

Set word wrap mode in rich edit control.

#### Parameters

Flag | True or false.

#### Returns

The return value is zero if the operation fails, or nonzero if it succeeds.

### Zoom

> Richedit_Zoom( | hCtrl, |
> | zoom | = | )

Sets the zoom ratio anywhere between 1/64 and 64.

#### Parameters

zoom | Integer amount to increase or decrease zoom with + or - infront of it (see examples).

#### Returns

If the new zoom setting is accepted, the return value is true. If the new zoom setting is not accepted, the return value is false. If zoom param is omitted, current numerator/denominator ratio is returned.

#### Examples

>     Msgbox, % "zoom ratio: " RichEdit_Zoom( hRichEdit )

>     #MaxHotkeysPerInterval 200
>     #IfWinActive ahk_group RichEditGrp
>     ^WheelUp::   RichEdit_Zoom( hRichEdit, +1 )
>     ^WheelDown:: RichEdit_Zoom( hRichEdit, -1 )
>     #IfWinActive

### Undo

> RichEdit_Undo( | hCtrl, |  |
> | Reset | = | false | )

Send message to Edit control to undo the next action in the control’s undo queue & optionally empty the undo buffer by resetting the undo flag.

#### Parameters

Reset | Set to true to clear the undo buffer rather than send undo command.

#### Returns

For a single-line edit control, the return value is always true. For a multiline edit control, the return value is true if the undo operation is successful, or false if the undo operation fails, or your resetting the undo queue.

### About

- Version 1.0b2 by freakkk & majkinetor.
- MSDN Reference : http://msdn.microsoft.com/en-us/library/bb787605(VS.85).aspx.
- RichEdit control shortcut keys: http://msdn.microsoft.com/en-us/library/bb787873(VS.85).aspx#rich_edit_shortcut_keys.
- Licensed under BSD http://creativecommons.org/licenses/BSD/.

> RichEdit_Add( | HParent, |  |
> | X | = | "",
> | Y | = | "",
> | W | = | "",
> | H | = | "",
> | Style | = | "",
> | Text | = | "" | )

Create rich edit version 4.1 control.

> RichEdit_AutoUrlDetect( | HCtrl, |  |
> | Flag | = | "" | )

Enable, disable, or toggle automatic detection of URLs in the RichEdit control.

> RichEdit_CanPaste( | hEdit, |  |
> | ClipboardFormat | = | 0x1 | )

Determines whether an Edit control can paste a specified clipboard format.

> RichEdit_CharFromPos( | hEdit,
> | X,
> | Y | )

Gets information about the character closest to a specified point in the client area of the Edit control.

> RichEdit_Clear( | hEdit | )

Send to an Edit control or combo box to delete (clear) the current selection.

> RichEdit_Convert( | Input, |
> | Direction | = | )

Convert twips to pixels or vice-versa.

> RichEdit_Copy( | hEdit | )

Copy selection of the Edit control.

> RichEdit_Cut( | hEdit | )

Cut selection from the Edit control.

> RichEdit_FindText( | hEdit, |  |
> | Text, |  |
> | CpMin | = | 0,
> | CpMax | = | -1,
> | Flags | = | "UNICODE" | )

Find desired text in the Edit control.

> RichEdit_FindWordBreak( | hCtrl, |  |
> | CharIndex, |  |
> | Flag | = | "" | )

Finds the next word break in rich edit conttrol, before or after the specified character position or retrieves information about the character at that position.

> RichEdit_FixKeys( | hCtrl | )

Fix Tab and Esc key handling in rich edit control.

> RichEdit_GetLine( | hEdit, |  |
> | LineNumber | = | -1 | )

Get the text of the desired line from an Edit control.

> RichEdit_GetLineCount( | hEdit | )

Gets the number of lines in a multiline Edit control.

> RichEdit_GetOptions( | hCtrl | )

Get the options for a rich edit control.

> RichEdit_GetCharFormat( |  | hCtrl, |  |
> | ByRef | Face | = | "",
> | ByRef | Style | = | "",
> | ByRef | TextColor | = | "",
> | ByRef | BackColor | = | "",
> |  | Mode | = | "SELECTION" | )

Determines the character formatting in a rich edit control.

> RichEdit_GetRedo( |  | hCtrl, |  |
> | ByRef | name | = | "-" | )

Determine whether there are any actions in the rich edit control redo queue, and optionally retrieve the type of the next redo action.

> RichEdit_GetModify( | hEdit | )

Gets the state of the modification flag for the Edit control.

> RichEdit_GetRect( |  | hEdit, |  |
> | ByRef | Left | = | "",
> | ByRef | Top | = | "",
> | ByRef | Right | = | "",
> | ByRef | Bottom | = | "" | )

Gets the formatting rectangle of the Edit control.

> RichEdit_GetSel( |  | hCtrl, |  |
> | ByRef | cpMin | = | "",
> | ByRef | cpMax | = | "" | )

Retrieve the starting and ending character positions of the selection in a rich edit control.

> RichEdit_GetText( | HCtrl, |  |
> | CpMin | = | "-",
> | CpMax | = | "-",
> | CodePage | = | "" | )

Retrieves a specified range of characters from a rich edit control.

> RichEdit_GetTextLength( | hCtrl, |  |
> | Flags | = | 0,
> | CodePage | = | "" | )

Calculates text length in various ways for a rich edit control.

> RichEdit_GetUndo( |  | hCtrl, |  |
> | ByRef | Name | = | "-" | )

Determine whether there are any actions in the Edit control undo queue, and optionally retrieve the type of the next undo action.

> RichEdit_HideSelection( | hCtrl, |  |
> | State | = | true | )

Hides or shows the selection in a rich edit control.

> RichEdit_LineFromChar( | hCtrl, |  |
> | CharIndex | = | -1 | )

Determines which line contains the specified character in a rich edit control.

> RichEdit_LineIndex( | hEdit, |  |
> | LineNumber | = | -1 | )

Returns the character index of the first character of a specified line in an Edit control.

> RichEdit_LineLength( | hEdit, |  |
> | LineNumber | = | -1 | )

Returns the length of a line in an Edit control.

> RichEdit_LineScroll( | hEdit, |  |
> | XScroll | = | 0,
> | YScroll | = | 0 | )

Scrolls the text in the Edit control.

> RichEdit_LimitText( | hCtrl, |
> | txtSize | = | )

Sets an upper limit to the amount of text the user can type or paste into a rich edit control.

> RichEdit_Paste( | hEdit | )

Paste clipboard into the Edit control.

> RichEdit_PasteSpecial( | HCtrl,
> | Format | )

Pastes a specific clipboard format in a rich edit control.

> RichEdit_PosFromChar( |  | hEdit,
> |  | CharIndex,
> | ByRef | X,
> | ByRef | Y | )

Gets the client area coordinates of a specified character in an Edit control.

> RichEdit_Redo( | hEdit | )

Do redo operation.

> RichEdit_ReplaceSel( | hEdit, |  |
> | Text | = | "" | )

Replace selection with desired text in the Edit control.

> RichEdit_Save( | hCtrl, |  |
> | FileName | = | "" | )

Save the content of the rich edit control using RT format.

> RichEdit_ScrollCaret( | hEdit | )

Scroll content of Edit control until caret is visible.

> RichEdit_ScrollPos( | HCtrl, |  |
> | PosString | = | "" | )

Obtain the current scroll position, or tell the rich edit control to scroll to a particular point.

> RichEdit_SelectionType( | hCtrl | )

Determines the selection type for a rich edit control.

> RichEdit_SetBgColor( | hCtrl,
> | Color | )

Sets the background color for a rich edit control.

> RichEdit_SetCharFormat( | HCtrl, |  |
> | Face | = | "",
> | Style | = | "",
> | TextColor | = | "",
> | BackColor | = | "",
> | Mode | = | "SELECTION" | )

Set character formatting in a rich edit control.

> RichEdit_SetEvents( | hCtrl, |  |
> | Handler | = | "",
> | Events | = | "selchange" | )

Set notification events.

> RichEdit_SetFontSize( | hCtrl,
> | Add | )

Sets the font size for the selected text in the rich edit control.

> RichEdit_SetModify( | hEdit, |  |
> | State | = | true | )

Sets or clears the modification flag for an edit control.

> RichEdit_SetOptions( | hCtrl,
> | Operation,
> | Options | )

Sets the options for a rich edit control.

> RichEdit_PageRotate( | hCtrl, |  |
> | R | = | "" | )

Rotate page.

> RichEdit_SetParaFormat( | hCtrl, |  |
> | o1 | = | "",
> | o2 | = | "",
> | o3 | = | "",
> | o4 | = | "",
> | o5 | = | "",
> | o6 | = | "" | )

Sets the paragraph formatting for the current selection in a rich edit control.

> RichEdit_SetEditStyle( | hCtrl,
> | Style | )

Sets the current edit style flags.

> RichEdit_SetSel( | hCtrl, |  |
> | CpMin | = | 0,
> | CpMax | = | 0 | )

Selects a range of characters or Component Object Model (COM) objects in a rich edit control.

> RichEdit_SetText( | HCtrl, |  |
> | Txt | = | "",
> | Flag | = | 0,
> | Pos | = | "" | )

Set text from string or file in rich edit control using either rich text or plain text.

> RichEdit_SetUndoLimit( | hCtrl,
> | nMax | )

Set the maximum number of actions that can stored in the undo queue of the rich edit control.

> RichEdit_ShowScrollBar( | hCtrl, |  |
> | Bar, |  |
> | State | = | true | )

Shows or hides scroll bars for Edit control.

> RichEdit_TextMode( | HCtrl, |  |
> | TextMode | = | "" | )

Get or set the current text mode of a rich edit control.

> RichEdit_WordWrap( | HCtrl,
> | Flag | )

Set word wrap mode in rich edit control.

> Richedit_Zoom( | hCtrl, |
> | zoom | = | )

Sets the zoom ratio anywhere between 1/64 and 64.

> RichEdit_Undo( | hCtrl, |  |
> | Reset | = | false | )

Send message to Edit control to undo the next action in the control’s undo queue & optionally empty the undo buffer by resetting the undo flag.
Close