Difference between revisions of "RichMemo"

From Lazarus wiki
m
Line 1: Line 1:
{{Lazarus DB Faq}}
+
<small>
 +
[[RichMemo|'''English (en)''']]
 +
[[RichMemo/ru|'''Русский (ru)''']]
 +
</small>
 +
 
  
 
=== About ===
 
=== About ===

Revision as of 13:58, 6 June 2009

English (en) Русский (ru)


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: not tested at all.

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; SetMask: TTextStyleMask; const TextParams: TFontParams); 
  • TextStart : Integer - the first character to be modified
  • TextLen : Integer - number of characters to be modified
  • SetMask : TTextStyleMask - what parameters should be applied. If mask is empty no changes is made.
  • TextParams : TFontParams - font parameters that should be applied that should be applied to the part of the text


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 RichMemoTypes). SetMask specifies what parameter should be applied. Parameters, that is not passed in the mask, is left unchanged. Using TFont to set text attributes change all text attributes to the same as in TFont.

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.