RichMemo

From Lazarus wiki
Revision as of 22:37, 20 June 2009 by Skalogryz (talk | contribs)
Jump to navigationJump to search

Template:Translate

About

TRichMemo is a component to replace Delphi TRichEdit component. It's designed in cross-platform way, so implementation is possible for the following platforms: Win32 and MacOSX. But also should be possible for Linux (Gtk and Qt).

Its main caracteristics are :

  • Text highlight
  • Import/Export RichText (not yet implemented)

Planned: (patches are welcomed)

  • Adding images into text
  • Embedding LCL Controls?

The download contains the component, an installation package and a demo application, that illustrates the features of the component along with some instrumentation for evaluating the chart on a given system.

Screenshot

todo: ...

Author

Dmitry 'skalogryz' Boyarintsev

License

modified LGPL (same as the FPC RTL and the Lazarus LCL). You can contact the author if the modified LGPL doesn't work with your project licensing.

Download

The latest trunk is available here: https://lazarus-ccr.svn.sourceforge.net/svnroot/lazarus-ccr/components/richmemo

Change Log

  • Version 0.8.0 date

Dependencies / System Requirements

  • Lazarus 0.9.27

Status: 'Beta'

Issues: Tested only on: Windows XP 32-bit Windows Vista 32-bit Windows Vista 64-bit Windows 7 32-bit Intel 10.5.7 Leopard

Installation

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

RichMemoPalette.PNG

Reference

TRichMemo methods

SetTextAttributes
 procedure SetTextAttributes(TextStart, TextLen: Integer; AFont: TFont); 
  • TextStart : Integer - the first character to be modified
  • TextLen : Integer - number of characters to be modified
  • AFont : TFont - a font that should be applied to the part of the text


 procedure SetTextAttributes(TextStart, TextLen: Integer; const TextParams: TFontParams); 
  • TextStart : Integer - the first character to be modified
  • TextLen : Integer - number of characters to be modified
  • TextParams : TFontParams - font parameters to be set


SetTextureAttributes methods are changing specified text range style. Font parameters is passed in both methods, by AFont parameter (LCL TFont object) or by TFontParams (declared at RichMemo).

Setting text attributes does not change current selection. If it's necessary to modify the style of currently selected text, you should SelStart and SelLength as a text range values:

 RichMemo1.SetTextAttributes(RichMemo1.SelStart, RichMemo1.SelLength, FontDialog1.Font);
GetTextAttributes
 function GetTextAttributes(TextStart: Integer; var TextParams: TFontParams): Boolean; virtual;
  • TextStart : Integer - the character position to be queried for font parameters
  • var TextParams : TFontParams - output value, filled with charachter's font attributes. If the method fails and returns false, record's field values is undefined.

Fill font params of the character, at TextStart position. Method returns True if textstart is valid character position, and False overwise.

TRichMemo properties

HideSelection
 property HideSelection: Boolean default false

Read/Write property. If True RichMemo selection is hidden if the control is not focused. If False, the selection is shown all the time.