Page 1 of 1

[Unit] Quoting text (like e-mail clients)

Posted: Wed Apr 07, 2010 8:27 pm
by Sergey Tkachenko
Update 2018-Apr-9: Download link to this unit is removed, because it is included in TRichView installation. It is: <TRichView Dir>\ThirdParty\CleverComponents\Demos\RVQuoteText.pas. This unit can be used separately from CleverComponents.

Code: Select all

procedure QuoteText(const Prefix: String; MaxLength: Integer; rv: TCustomRichView);
This function quotes all text in rv.
Parameters:
Prefix - text to insert before each line (for example, '>', or 'John>')
MaxLength - length of lines, in pixels. Lines exceeding this width will be separated into smaller lines. Width of Prefix is not taken into account.

This procedure formats document. It is not necessary to format document before calling this procedure.

This is not an editing operation. If it is called for TRichViewEdit, call RichViewEdit.ClearUndo after.

Example:

Code: Select all

  QuoteText('>', RichViewEdit1.ClientWidth-50, RichViewEdit1);
  RichViewEdit1.ClearUndo;
Note: this unit is included in the demo implementing a simple e-mail client using Clever Internet Suite, see http://www.trichview.com/forums/viewtop ... f=6&t=4123