Skip to content

TStyledTaskDialog - Technical Reference

Overview

TStyledTaskDialog is an advanced task dialog component that replaces MessageDlg and TaskDialog with fully customizable dialogs featuring styled buttons and optional animations.

Class Hierarchy

TComponent
  └─ TCustomTaskDialog
      └─ TStyledTaskDialog

Unit

pascal
Vcl.StyledTaskDialog

Description

TStyledTaskDialog provides a modern, fully customizable alternative to standard Windows dialogs. It supports styled buttons, custom icons, animations (via Skia4Delphi), progress bars, command links, radio buttons, verification checkboxes, and much more.

Key Features

  • Styled buttons: Full StyleFamily/Class/Appearance support
  • Custom icons: ImageList or animated icons (Lottie files via Skia4Delphi)
  • Progress bar: Determinate or marquee progress indicators
  • Command links: Large clickable areas with descriptions
  • Radio buttons: Multiple-choice options
  • Verification checkbox: "Don't show this again" option
  • Expandable content: Collapsible additional information
  • Footer: Optional footer area with text and icon
  • Auto-click: Automatic button click after delay
  • Full customization: Complete control over appearance

Main Properties

Dialog Content

PropertyTypeDescription
TitleStringDialog title/caption
TextStringMain message text
ExpandedTextStringAdditional expandable information
ExpandButtonCaptionStringCaption for expand button
FooterTextStringFooter text
VerificationTextStringVerification checkbox text

Icons

PropertyTypeDescription
MainIconTTaskDialogIconMain icon (tdiNone, tdiWarning, tdiError, tdiInformation, tdiShield, tdiQuestion)
CustomMainIconTIconCustom icon instead of standard
FooterIconTTaskDialogIconFooter icon
MainIconSizeIntegerSize of main icon

Buttons

PropertyTypeDescription
CommonButtonsTTaskDialogCommonButtonsStandard buttons ([tcbOk, tcbYes, tcbNo, tcbCancel, tcbRetry, tcbClose])
CustomButtonsTTaskDialogButtonsCustom button collection
DefaultButtonTTaskDialogCommonButtonWhich button is default
DialogButtonsFamilyTStyledButtonFamilyStyle family for buttons

Style Properties

PropertyTypeDescription
UseTitleInMessageDlgBooleanShow title in simple message dialogs
UseCommandLinksBooleanUse command link style for buttons
AlphaBlendValueByteDialog transparency (0-255)

Progress Bar

PropertyTypeDescription
ProgressBar.MinIntegerMinimum progress value
ProgressBar.MaxIntegerMaximum progress value
ProgressBar.PositionIntegerCurrent progress position
ProgressBar.StateTProgressBarStateState (pbsNormal, pbsError, pbsPaused)
ProgressBar.StyleTProgressBarStyleStyle (pbstNormal, pbstMarquee)

Radio Buttons

PropertyTypeDescription
RadioButtonsTTaskDialogButtonsRadio button options
DefaultRadioButtonIntegerDefault selected radio button

Animations (Skia4Delphi)

PropertyTypeDescription
UseAnimationsBooleanEnable Lottie animations for icons
UseAnimationLoopBooleanLoop animation continuously
UseAnimationInverseBooleanPlay animation in reverse

Auto-Click

PropertyTypeDescription
AutoClickBooleanAutomatically click button after delay
AutoClickDelayIntegerDelay before auto-click (milliseconds)

Behavior

PropertyTypeDescription
FlagsTTaskDialogFlagsDialog behavior flags
PositionTPointCustom dialog position
HideSystemCloseButtonBooleanHide X button in title bar

Events

EventDescription
OnDialogCreatedDialog form created (before shown)
OnDialogShowDialog is being shown
OnDialogConstructedDialog constructed (after shown)
OnDialogDestroyedDialog closed and destroyed
OnButtonClickedButton clicked (can cancel)
OnHyperlinkClickedHyperlink in text clicked
OnRadioButtonClickedRadio button selected
OnVerificationClickedVerification checkbox clicked
OnExpandedExpandable content shown/hidden

Usage Examples

Simple Message Dialog

pascal
uses
  Vcl.StyledTaskDialog;

begin
  StyledMessageDlg('File saved successfully!', mtInformation, [mbOK], 0);
end;

Confirmation Dialog

pascal
var
  Dlg: TStyledTaskDialog;
begin
  Dlg := TStyledTaskDialog.Create(Self);
  try
    Dlg.Title := 'Confirm Delete';
    Dlg.Text := 'Are you sure you want to delete this file?';
    Dlg.MainIcon := tdiWarning;
    Dlg.CommonButtons := [tcbYes, tcbNo];
    Dlg.DefaultButton := tcbNo;
    Dlg.DialogButtonsFamily := BOOTSTRAP_FAMILY;

    if Dlg.Execute then
      if Dlg.ModalResult = mrYes then
        DeleteFile(FileName);
  finally
    Dlg.Free;
  end;
end;

Dialog with Custom Buttons

pascal
Dlg := TStyledTaskDialog.Create(Self);
try
  Dlg.Title := 'Choose Action';
  Dlg.Text := 'What would you like to do?';
  Dlg.MainIcon := tdiInformation;

  with Dlg.CustomButtons.Add do
  begin
    Caption := 'Save and Continue';
    ModalResult := 100;
  end;

  with Dlg.CustomButtons.Add do
  begin
    Caption := 'Discard Changes';
    ModalResult := 101;
  end;

  Dlg.DialogButtonsFamily := BOOTSTRAP_FAMILY;

  if Dlg.Execute then
    case Dlg.ModalResult of
      100: SaveAndContinue;
      101: DiscardChanges;
    end;
finally
  Dlg.Free;
end;

Dialog with Progress Bar

pascal
Dlg := TStyledTaskDialog.Create(Self);
try
  Dlg.Title := 'Processing';
  Dlg.Text := 'Please wait while files are being processed...';
  Dlg.MainIcon := tdiInformation;
  Dlg.CommonButtons := [tcbCancel];
  Dlg.ProgressBar.Style := pbstMarquee;  // Indeterminate progress

  Dlg.Execute;
finally
  Dlg.Free;
end;

Dialog with Radio Buttons

pascal
Dlg := TStyledTaskDialog.Create(Self);
try
  Dlg.Title := 'Choose Format';
  Dlg.Text := 'Select export format:';
  Dlg.MainIcon := tdiQuestion;
  Dlg.CommonButtons := [tcbOk, tcbCancel];

  Dlg.RadioButtons.Add.Caption := 'PDF Document';
  Dlg.RadioButtons.Add.Caption := 'Excel Spreadsheet';
  Dlg.RadioButtons.Add.Caption := 'Word Document';
  Dlg.DefaultRadioButton := 0;

  if Dlg.Execute and (Dlg.ModalResult = mrOk) then
    case Dlg.RadioButton.ID of
      0: ExportToPDF;
      1: ExportToExcel;
      2: ExportToWord;
    end;
finally
  Dlg.Free;
end;

Dialog with Verification Checkbox

pascal
Dlg := TStyledTaskDialog.Create(Self);
try
  Dlg.Title := 'Important Information';
  Dlg.Text := 'This is an important message.';
  Dlg.MainIcon := tdiInformation;
  Dlg.CommonButtons := [tcbOk];
  Dlg.VerificationText := 'Don''t show this message again';

  Dlg.Execute;

  if tfVerificationFlagChecked in Dlg.Flags then
    // Save preference not to show again
    SaveSetting('ShowImportantMessage', False);
finally
  Dlg.Free;
end;

Dialog with Expandable Content

pascal
Dlg := TStyledTaskDialog.Create(Self);
try
  Dlg.Title := 'Error Occurred';
  Dlg.Text := 'An error occurred while processing your request.';
  Dlg.ExpandedText := 'Technical details:' + #13#10 + ExceptionMessage;
  Dlg.ExpandButtonCaption := 'Show Details';
  Dlg.MainIcon := tdiError;
  Dlg.CommonButtons := [tcbOk];

  Dlg.Execute;
finally
  Dlg.Free;
end;

Auto-Close Dialog

pascal
Dlg := TStyledTaskDialog.Create(Self);
try
  Dlg.Title := 'Operation Complete';
  Dlg.Text := 'This dialog will close automatically in 5 seconds.';
  Dlg.MainIcon := tdiInformation;
  Dlg.CommonButtons := [tcbOk];
  Dlg.AutoClick := True;
  Dlg.AutoClickDelay := 5000;

  Dlg.Execute;
finally
  Dlg.Free;
end;

Global Dialog Configuration

pascal
// In project DPR file
uses
  Vcl.StyledButton, Vcl.ButtonStylesAttributes, Vcl.StyledTaskDialog;

begin
  Application.Initialize;

  // Set default button style
  TStyledButton.RegisterDefaultRenderingStyle(
    btRounded,
    BOOTSTRAP_FAMILY,
    btn_primary,
    BOOTSTRAP_NORMAL
  );

  // Initialize styled dialogs with font and button family
  InitializeStyledTaskDialogs(
    True,                  // Use styled dialogs
    Screen.MessageFont,    // Dialog font
    BOOTSTRAP_FAMILY       // Button family
  );

  Application.CreateForm(TMainForm, MainForm);
  Application.Run;
end.

Helper Functions

StyledMessageDlg

Replacement for MessageDlg:

pascal
function StyledMessageDlg(const Msg: string; DlgType: TMsgDlgType;
  Buttons: TMsgDlgButtons; HelpCtx: Longint): Integer;

StyledTaskMessageDlg

Alternative task dialog function:

pascal
function StyledTaskMessageDlg(const Title, Msg: string; DlgType: TMsgDlgType;
  Buttons: TMsgDlgButtons; HelpCtx: Longint): Integer;

InitializeStyledTaskDialogs

Configure global dialog settings:

pascal
procedure InitializeStyledTaskDialogs(
  AUseStyledDialogs: Boolean;
  ADialogFont: TFont;
  ADialogButtonsFamily: TStyledButtonFamily);

Important Notes

  • Replaces MessageDlg: Use StyledMessageDlg instead of MessageDlg
  • Animations: Require Skia4Delphi for Lottie animation support
  • Custom Forms: Can use custom dialog forms via TStyledTaskDialogForm
  • DPI Aware: Automatically scales with DPI changes
  • Modal Result: Returns standard modal results (mrOk, mrCancel, etc.) or custom values

See Also

Released under Apache License, Version 2.0.