This sample demonstrates the main features of a TRichEdit component. It also exemplifies how to create a localized application.
You can find the RichEdit sample project at:
- Start > Programs > Embarcadero RAD Studio > Samples and then navigate to Delphi\VCL\RichEdit
- Subversion Repository for Delphi: http://sourceforge.net/p/radstudiodemos/code/HEAD/tree/branches/RadStudio_XE4/Delphi/VCL/RichEdit/
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
- Navigate to Start > Programs > Embarcadero RAD Studio > Samples and open richedit.dproj.
- Press F9 or choose Run > Run.
Methods used to change the language interface at run time
RichEdit main form
richedit.FRA, richedit.DEU, richedit.JPN, richedit.ENU are the projects that contain the translated string tables and the translated forms.
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.
- 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.