LzRichEdit

About

edit

This component was created to solve or at least alleviate the lack of RichText component. Component runs on two platforms: Linux (GTK2) / Windows, and has different ways to work on both OS'es.

  • Control in Windows is provided by OS API. Win version supports all features that Win32 API has.
  • Linux file reading is made by FPC TRTFParser class, with some changes to support images, this class is slower on complex files. Linux version supports only text formatting.

The two most important properties are Paragraph and SelAttributes, one takes care of the attributes of the paragraph and the other attributes of text.

Screenshot:

Author

edit

Elson Junio (elsonjunio@yahoo.com.br).

Antônio Galvão.

Platforms

edit

Linux (Gtk2) and Win32.

License

edit

modified LGPL.

Download

edit

The latest version is available here: http://sourceforge.net/projects/lazarusfiles/files/lzRichEdit.zip/download

SVN: https://lazarus-br.googlecode.com/svn/trunk/package/lzRichEdit

Installation

edit
  • Download the package
  • Open the package, and install it, rebuilding the IDE
  • TlzRichEdit is added to 'Common Controls' component page.

Methods

edit

CopyToClipboard

edit

Copies RTF text to clipboard.

CutToClipboard

edit

Cuts RTF text to clipboard.

PasteFromClipboard

edit

Pastes RTF text from clipboard.

FindText

edit

Finds text in the control contents.

GetFirstVisibleLine

edit

Gets the first visible line.

GetRTFSelection

edit

Gets the selected RTF text to a provided stream.

PutRTFSelection

edit

Puts the contents of a source RTF stream in the caret position.

GetWordAtPoint

edit

Gets the word at the (x,y) position.

GetWordAtPos

edit

Gets the word at the text position.

GetZoomState

edit

Gets the zoom state of the RichEdit.

SetZoomState

edit

Sets the zoom state of the RichEdit.

LoadFromFile

edit

Loads a file.

SaveToFile

edit

Saves a file.

Print

edit

Prints the contents of the control.

Undo

edit

Undo modifications.

Redo

edit

Redo modifications.

ScrollLine

edit

Scrolls for a given delta line position.

ScrollToCaret

edit

Scrolls to the caret.

SelectAll

edit

Selects all text.

Properties

edit

Paragraph

edit

It is possible to change the current paragraph attributes (it is guided by SelStart) property.

Alignment: TRichEditAlignment
edit

Sets / gets the alignment of the paragraph or selected text.

traLeft
edit

Paragraph aligned to left.

traRight
edit

Paragraph aligned to right.

traCenter
edit

Paragraph centered.

traJustify
edit

Paragraph justified.

FirstIndent: Longint
edit

Sets / gets the indentation of the first line of a paragraph, FirstIndent works differently on Linux and Windows. Under Windows it has a relationship LeftIndent proportional to its value and shouldnt be negative if you want your effect is the recoil of the line, Otherwise the line is advanced. Linux does not the relationship between LeftIndent and FirstIndent and its value must be positive for Causing the retreat of line.

LeftIndent: Longint
edit

Sets / gets the paragraph indentation left.

RightIndent: Longint
edit

Sets / gets the distance from the text in the paragraph right corner of the control.

Numbering: TnumberingStyle
edit

Inserts \ checks in paragraph marker, only one paragraph at a time.

SelAttributes

edit

It is possible to change and get attribute values of the selected text.

Color: TColor
edit

Used to set / get the color of the selected text.

BackColor: TColor
edit

Used to set / get the background color of the selected text.

Name: TFontName
edit

Used to set / get the font of the selected text.

Size: Integer
edit

Used to set / get the font size of the selected text.

Style: TFontStyles
edit

Used to set / recer the font style of the selected text (Linux / Windows).

CaretCoordinates

edit
Column :Integer
edit

Reads the caret column position.

Line :Integer
edit

Reads the caret line position.

CaretPoint

edit
X :Integer
edit

Reads the X pixels position of the caret.

Y :Integer
edit

Reads the Y pixels position of the caret.

ScrollPoint

edit
X :Integer
edit

Reads and writes the X scrolling position.

Y :Integer
edit

Reads and writes the Y scrolling position.

DefaultExtension

edit
string
edit

Provides a way to set a file extension different than ".RTF" which can be correctly opened.

Graphic support

edit

The images support is left up to 3 units:

  • RichOleBox
  • RichOle
  • GTKTextImage

These units are in the sample folder and can be placed along with the source code of your program.

More information

edit

For more information, see the Example Project or contact the author.