Table of Contents

Animation and Overlay

Waiting indicators should communicate that work is active without suggesting a precise completion time. Use OverlayParent when users should not interact with the parent area while the operation is running.

Overlay a Busy Region

Set OverlayParent to cover the parent control while the indicator is active. This is useful for panels, dialogs, or data regions that should pause interaction while data loads.

procedure TForm1.StartLoading;
begin
  TMSFNCWaitingIndicator1.OverlayParent := True;
  TMSFNCWaitingIndicator1.AnimationSpeed := 1.0;
  TMSFNCWaitingIndicator1.Active := True;
end;

procedure TForm1.FinishLoading;
begin
  TMSFNCWaitingIndicator1.Active := False;
end;

Tune the Appearance

Use AnimationSpeed to match the pace of the application. The Appearance object controls the indicator and movement shape; choose a shape that remains readable at the component size.

procedure TForm1.ConfigureWaitingIndicator;
begin
  TMSFNCWaitingIndicator1.Appearance.IndicatorShape := wisCircle;
  TMSFNCWaitingIndicator1.Appearance.MoveShape := wmsCircle;
  TMSFNCWaitingIndicator1.AnimationSpeed := 0.8;
  TMSFNCWaitingIndicator1.OverlayParent := True;
end;

Drawing Hooks

OnBeforeDrawIndicator and OnBeforeDrawOverlay can suppress default drawing for specialized scenarios. Use these hooks sparingly; most applications should style the indicator through Appearance.

Combining overlay, tuned appearance, and a drawing hook

The following example overlays a panel while data loads, slows the animation to match a smooth loading feel, and uses OnBeforeDrawOverlay to tint the overlay semi-transparent:

procedure TForm1.LoadData;
begin
  // cover the data panel
  TMSFNCWaitingIndicator1.OverlayParent := DataPanel;
  TMSFNCWaitingIndicator1.AnimationSpeed := 40;  // slower = calmer feel
  TMSFNCWaitingIndicator1.Appearance.IndicatorShape := wisCircle;
  TMSFNCWaitingIndicator1.Visible := True;

  TTask.Run(procedure
  begin
    // ... fetch data ...
    TThread.Synchronize(nil, procedure
    begin
      DataPanel.Refresh;
      TMSFNCWaitingIndicator1.Visible := False;
    end);
  end);
end;

procedure TForm1.TMSFNCWaitingIndicator1BeforeDrawOverlay(
  Sender: TObject; AGraphics: TTMSFNCGraphics; ARect: TRectF;
  var ADefaultDraw: Boolean);
begin
  // semi-transparent dark overlay instead of the default
  AGraphics.Fill.Color := MakeColor(0, 0, 0, 160);
  AGraphics.DrawRectangle(ARect);
  ADefaultDraw := False;
end;

See Also