VCL.RichEdit Sample

From RAD Studio Code Examples
Jump to: navigation, search

Language:

This sample demonstrates the main features of a TRichEdit component. It also exemplifies how to create a localized application.

Contents

Location

You can find the RichEdit sample project at:

Description

This application represents a text editor that provides more advanced functionality in comparison to the ActionBands editor. Along with basic file functionalities (new, save, open, print document) and edit functionalities (copy, cut, paste text), the application allows the user to set the font family and size of the text, to create bulleted lists, and to handle tabs and indentation. It also allows the user to swap through the localized versions of the editor.

How to Use the Sample

  1. Navigate to Start > Programs > Embarcadero RAD Studio > Samples and open richedit.dproj.
  2. Press F9 or choose Run > Run.

Files

File Contains

reinit

Methods used to change the language interface at run time

remain

RichEdit main form

richedit.FRA, richedit.DEU, richedit.JPN, richedit.ENU are the projects that contain the translated string tables and the translated forms.

Classes

TMainForm represents the main window of the editor. It contains a main menu and a toolbar, a ruler, and a TRichEdit component for entering text.

Implementation

  • Use the reinit unit in other applications if you need to swap through localized versions at run time by calling the ReinitializeForms procedure.
  • A panel, a bevel, and three labels are used to simulate a ruler. Changing the positions of these labels sets the Paragraph property of the TRichEdit component.
  • The Paragraph property is used to set the indentations, alignment, and numbering of the text.
  • Some methods from the Windows unit are used; for instance EnumFonts -- to load the fonts available into the font combo box and SendMessage -- to send windows messages.
  • WMDropFiles is a message-handling method that manages the dragging and dropping of text files onto the editor.

Uses

See Also

Personal tools