RichEditCtrl Control

Purpose

Creates a rich edit control.

Syntax

RichEditCtrl text$, ID%, x%, y%, w%, h%[,style%]

Description

A “rich edit control” is a window in which the user can enter and edit text. The text can be assigned character and paragraph formatting, and can include embedded OLE objects. Rich edit controls provide a programming interface for formatting text. However, an application must implement any user interface components necessary to make formatting operations available to the user.

Rich edit controls support almost all of the operations and notification messages used with multiline edit controls. Thus, applications that already use edit controls can be easily changed to use rich edit controls. Additional messages and notifications enable applications to access the functionality unique to rich edit controls. For information about edit controls, see EditText control.

style%:

ES_LEFT - sets the text left justified in the edit field

ES_CENTER - centers the text within a multi-line edit field.

ES_RIGHT - sets the text right justified within a multi-line edit field.

ES_MULTILINE - defines a multi-line edit field.

ES_AUTOVSCROLL - scrolls the text one page up when the user presses the Return key on the last line.

ES_AUTOHSCROLL - when further characters are entered at the end of the line, scrolls the text ten characters to the left. Pressing the Return key sets the text back to position zero.

ES_NOHIDESEL - makes the selected entry in an edit field permanently visible.

ES_DISABLENOSCROLL - Disables scrollbars instead of hiding them when they are not needed.

ES_EX_NOCALLOLEINIT - Prevents the control from calling theOleInitialize function when created. Useful only in dialog templates because CreateWindowEx does not accept this style.

ES_NOIME - Disables the input method editor (IME) operation. Available for Asian-languages only.

ES_SAVESEL - Preserves the selection when the control loses the focus. By default, the entire contents of the control are selected when it regains the focus.

ES_SELFIME - Directs the rich edit control to allow the application to handle all IME operations. Available for Asian-languages only.

ES_SUNKEN - Displays the control with a sunken border style so that the rich edit control appears recessed into its parent window.
Windows 95: Applications developed for Windows 95 should use WS_EX_CLIENTEDGE instead of ES_SUNKEN.

ES_VERTICAL - Draws text and objects in a vertical direction. Available for Asian-languages only.

Rich edit controls support most of the notification messages used with edit controls, plus some more. Use the WinApi32.Hlp or MS Windows SDK to get more information about Rich edit controls.

Example

Dlg 3D On

Global style%, style2%, file$

Dlg Base Unit

style% = WS_BORDER | WS_TABSTOP

style2% = BS_DEFPUSHBUTTON | WS_TABSTOP

Dialog # 1, 10, 10, 150, 100, "Test-Dialog"

RichEditCtrl "", 101, 50, 10, 80, 14, style%

PushButton "OK", IDOK, 10, 60, 40, 14, style2%

PushButton "CANCEL", IDCANCEL, 80, 60, 40, 14, style2%

EndDialog

ShowDialog # 1

// to fill the edit field

file$ = "GFA-User"

_Win$(Dlg(1, 101)) = file$

Do

Sleep

Until Me Is Nothing

 

Sub Dlg_1_Message(hWnd%, Mess%, wParam%, lParam%)

Select Mess

Case WM_COMMAND

Select wParam

Case IDOK

file$ = _Win$(Dlg(1, 101))

CloseDialog # 1

OpenW 1

Print file$ : Print

Print "End with Alt + F4"

EndSelect

EndSelect

EndSub

Remarks

You can only type text into the edit field if it has the focus. The text can be read by using the _Win$() function and set by using _Win$()=.

This command is particular useful for a dialog box in a GLL, because a GLL doesn't support OCX controls.

With the general Control statement any control type can be created.

See Also

Control, AnimateCtrl, AutoCheckBox, AutoRadioButton, CheckBox, ComboBox, CText, Dialog, DefPushButton, EditText, GroupBox, HeaderCtrl, ListBox, ListViewCtrl, LText, ProgressCtrl, PushButton, RadioButton, RichEditCtrl, RText, ScrollBar, StatusCtrl, TabCtrl, ToolBarCtrl, TrackBarCtrl, TreeViewCtrl, UpDownCtrl

{Created by Sjouke Hamstra; Last updated: 22/10/2014 by James Gaite}