TMS FNC Blox ToolBar — Guides
The Blox toolbars give a TTMSFNCBloxControl ready-made editing UI — insert,
format, align, undo/redo, zoom — with little or no code. The main
TTMSFNCBloxToolBar initializes a full editing toolbar in one call; the four
specialized sub-toolbars expose focused command groups you can place
individually. Reach for the toolbars whenever you want users to edit diagrams
interactively without building your own command UI. This guide covers the
toolbar set, linking, quick setup, and overriding command behaviour.
Important
The toolbar components live in a separate bridge package that depends on the TMS FNC UI Pack (minimum 1.7.4.0). Install that package before dropping a toolbar — see the product installation notes.
Available toolbars
| Toolbar | Purpose |
|---|---|
TTMSFNCBloxToolBar |
The full editing toolbar; InitializeDefault populates it with the standard tool set. |
TTMSFNCBloxEditToolBar |
General edit commands: cut, copy, paste, delete, undo, redo. |
TTMSFNCBloxFormatBlockToolBar |
Block appearance: fill colour, stroke style, shadow, rounding. |
TTMSFNCBloxFormatBlockTextToolBar |
Text formatting: font, size, bold, italic, underline, alignment. |
TTMSFNCBloxSelectToolBar |
Selection and interaction modes: pointer, pan, connect. |
Linking toolbars
Each toolbar has a BloxControl property. Assign it to the target
TTMSFNCBloxControl; several toolbars can share one control. When a toolbar
detects a blox control on the form, it auto-assigns the first instance it finds
during creation, so often no code is needed at all.
procedure TForm1.FormCreate(Sender: TObject);
begin
BloxEditToolBar1.BloxControl := BloxControl1;
BloxFormatBlockToolBar1.BloxControl := BloxControl1;
BloxFormatBlockTextToolBar1.BloxControl := BloxControl1;
end;
Quick setup
TTMSFNCBloxToolBar.InitializeDefault fills the toolbar with the standard set of
diagramming tools, giving a working editor immediately. Rebuild re-initializes
it after registering custom elements.
procedure TForm1.SetUpToolBar;
begin
BloxToolBar1.BloxControl := BloxControl1;
BloxToolBar1.InitializeDefault; { standard insert/format/edit/zoom tools }
end;
Toolbar state
Toolbar buttons reflect the current selection automatically. When blocks are selected, format buttons show the selected elements' current appearance values and enable the corresponding actions; when nothing is selected, those buttons are disabled.
Overriding command behaviour
Each command raises an OnApply… event (for example OnApplyFillColor,
OnApplyText, OnApplyFontSize) or a notification event (OnUndo, OnCopy).
These events let you customise or override the default behaviour — and that is a
deliberate trade-off: once you assign an OnApply… handler, the toolbar no
longer performs that action itself; your handler is responsible for applying it
to the element it receives. This example recolours the selected element and logs
the change:
procedure TForm1.BloxFormatBlockToolBar1ApplyFillColor(Sender: TObject;
AElement: TTMSFNCBloxElement; AColor: TTMSFNCGraphicsColor);
begin
{ You assigned the handler, so you must apply the change. }
if AElement is TTMSFNCBloxBlock then
TTMSFNCBloxBlock(AElement).FillColor := AColor;
StatusLabel.Text := 'Fill colour applied';
end;
Pitfalls
- Assigning an
OnApply…handler suppresses the default action. Apply the change toAElementyourself, or the command appears to do nothing. - The toolbar needs the TMS FNC UI Pack bridge package. Without it the components are not installed and cannot be dropped on a form.
- Re-
Rebuildafter registering custom elements so new tools appear.