← Back to Index

TFlexFMXProgressDialog

Modal progress dialog for long-running operations with cancellation support.

Key Properties

Title: string
Dialog title text.
Message: string
Progress status message.
Progress: Integer
Current progress value (0-100).
Indeterminate: Boolean
Show spinning indicator instead of progress bar.
ShowPercentage: Boolean
Display percentage text.
Cancelable: Boolean
Allow user to cancel operation.
Cancelled: Boolean (read-only)
True if user clicked Cancel button.
CancelButtonText: string
Custom text for cancel button (default: "Cancel").
ShowElapsedTime: Boolean
Display elapsed time counter.

Usage Examples

File Processing

ProgressDialog1.Title := 'Processing Files';
ProgressDialog1.Message := 'Please wait...';
ProgressDialog1.Cancelable := True;
ProgressDialog1.ShowPercentage := True;
ProgressDialog1.Show;

for I := 1 to FileCount do
begin
  if ProgressDialog1.Cancelled then Break;
  
  ProcessFile(Files[I]);
  ProgressDialog1.Progress := Round((I / FileCount) * 100);
  ProgressDialog1.Message := Format('Processing file %d of %d', [I, FileCount]);
  Application.ProcessMessages;
end;

ProgressDialog1.Hide;

Indeterminate Progress

ProgressDialog1.Title := 'Connecting...';
ProgressDialog1.Message := 'Establishing connection to server';
ProgressDialog1.Indeterminate := True;
ProgressDialog1.Cancelable := True;
ProgressDialog1.Show;

try
  ConnectToServer;
finally
  ProgressDialog1.Hide;
end;

Download Progress

ProgressDialog1.Title := 'Downloading';
ProgressDialog1.ShowElapsedTime := True;
ProgressDialog1.ShowPercentage := True;
ProgressDialog1.Cancelable := True;
ProgressDialog1.Show;

procedure OnDownloadProgress(Sender: TObject; BytesReceived, TotalBytes: Int64);
begin
  if ProgressDialog1.Cancelled then
    AbortDownload;
  
  ProgressDialog1.Progress := Round((BytesReceived / TotalBytes) * 100);
  ProgressDialog1.Message := Format('%.1f MB / %.1f MB', 
    [BytesReceived / 1048576, TotalBytes / 1048576]);
end;

Async Operation

ProgressDialog1.Title := 'Loading Data';
ProgressDialog1.Indeterminate := True;
ProgressDialog1.Show;

TTask.Run(procedure
begin
  var Data := LoadData; // Long operation
  
  TThread.Synchronize(nil, procedure
  begin
    ProgressDialog1.Hide;
    DisplayData(Data);
  end);
end);

Methods

Events

Notes

← Back to Index