Table of Contents

Connecting toolbars to an editor

TMS FNC Toolbars are five self-contained, purpose-built toolbars that drive a compatible control — typically a TTMSFNCRichEditor — through a single Control property. Each toolbar builds its own buttons automatically and keeps them synchronised with the connected control: when the editor's selection or state changes, the relevant buttons update to match. Reach for these instead of wiring up your own buttons when you need a ready-made formatting or action bar for a rich editor.

Toolbar Purpose
TTMSFNCFontToolBar Font name, size, bold, italic, underline, strikeout, text and background colour
TTMSFNCParagraphToolBar Alignment, indent, unindent, bullets, numbering
TTMSFNCInsertToolBar Insert image, insert hyperlink
TTMSFNCClipboardToolBar Cut, copy, paste, undo, redo
TTMSFNCFileIOToolBar Open file, save file
A font toolbar above a paragraph toolbar A font toolbar above a paragraph toolbar

The Control property

Drop a toolbar onto the form, then set its Control to the editor you want it to drive. The toolbar creates its buttons on construction and binds their actions to the control. Assigning Control is all it takes — the bar is live immediately.

Automatic synchronisation

Once connected, the toolbars are state-aware: moving the caret into bold text presses the bold button, into a centered paragraph selects the center-align button, and so on. You do not poll the editor — the toolbar's Notify mechanism updates the buttons for you. To read that reflected state in code, use each toolbar's Settings object (see Formatting toolbars).

Note

The buttons build even before a Control is assigned, so the bar renders at design time. Actions only take effect once Control points at a supported editor.

Combining several toolbars on one editor

The five toolbars are independent, so a complete editor UI simply points each one at the same control — a font and paragraph bar for formatting plus clipboard, insert and file I/O bars for actions, all driving one editor:

// Connect a TTMSFNCFontToolBar to a TTMSFNCRichEditor via the Control property.
// The toolbar reads and applies font changes directly to the editor.

procedure TForm1.FormCreate(Sender: TObject);
begin
  TMSFNCFontToolBar1.Control     := TMSFNCRichEditor1;
  TMSFNCParagraphToolBar1.Control := TMSFNCRichEditor1;
  TMSFNCInsertToolBar1.Control    := TMSFNCRichEditor1;
  TMSFNCClipboardToolBar1.Control := TMSFNCRichEditor1;
  TMSFNCFileIOToolBar1.Control    := TMSFNCRichEditor1;
end;

Common mistakes

  • Forgetting to set Control. Without it the buttons appear but do nothing — set Control in code or the Object Inspector.
  • Pointing toolbars at different controls. Toolbars that should act together must share the same Control.

See also