Table of Contents

Getting started with TMS FNC WX HTML Memo

TTMSFNCWXHTMLMemo gives you a complete WYSIWYG HTML editor — a formatting toolbar plus an editing surface — on a form in a few steps. This page covers the minimal setup; the guides go deeper into each area.

Prerequisites

  • TMS FNC Core installed and the runtime package added to the project.
  • TMS FNC WX Pack installed.

Add the component

  1. Drop TTMSFNCWXHTMLMemo from the component palette onto a form.
  2. Optionally assign initial markup through HTML.Text (the HTML property is a TStrings).
  3. Handle OnContentChange to be notified when the content changes.

A TTMSFNCWXHTMLMemo on a form: a formatting toolbar above an editing area populated with a heading, formatted text, a highlight, a link and a bulleted list.

Seed content and react to edits

procedure TForm1.FormCreate(Sender: TObject);
begin
  { HTML is a TStrings: assign markup through its Text property. }
  TMSFNCWXHTMLMemo1.HTML.Text :=
    '<h2>Release notes</h2>' +
    '<p>Type here to edit. Use the toolbar or the keyboard shortcuts.</p>';

  TMSFNCWXHTMLMemo1.OnContentChange := HTMLMemoContentChange;
end;

procedure TForm1.HTMLMemoContentChange(Sender: TObject;
  HTMLContent, ContentPlainText: string);
begin
  { Fires after every edit. HTMLContent is the markup; ContentPlainText is
    the same content with all tags stripped. }
  StatusBar1.Text := Format('%d characters', [Length(ContentPlainText)]);
end;
Important

HTML is a TStrings. Assign markup with HTMLMemo1.HTML.Text := '<p>…</p>' and read it back with HTMLMemo1.HTML.Text — a direct HTMLMemo1.HTML := '…' does not compile. For tag-free text, read the PlainText property.

Next steps