Delphi TTaskDialog show/hide or start/stop marquee progress bar

479 views Asked by At

I have a TTaskDialog that has an OnButtonClicked event handler, in which a lengthy process (several seconds) is performed. This works fine, but I'd like some indication to the user that things are happening while that lengthy process is chugging along. I would like to have a marquee progress bar on the dialog that is initially hidden, appears when the CommandLink is clicked, and runs while the lengthy process is performed - I'd settle for a progress bar that is visible but not enabled when the dialog is displayed and is "turned on" in the OnButtonClicked event. Just including the tfShowMarqueeProgressBar flag causes the bar to appear and be scrolling when the dialog first displays, and the ProgressBar property of the dialog doesn't have Enabled or Visible type properties to control this behavior.

There are TaskDialogs in Windows itself that do what I want, so I know it's theoretically possible, though I realize that the structure of the VCL wrapper around the native control may make it difficult or impossible using the VCL object.

Is what I want possible using the TTaskDialog VCL object?

1

There are 1 answers

2
Olaf Hess On

The Windows API provides the message TDM_NAVIGATE_PAGE to change the TaskDialog at runtime. You would have to pass a TASKDIALOGCONFIG structure along with this message that defines the dialog's properties. In its dwFlags field you could specify the TDF_SHOW_PROGRESS_BAR flag to show the progress bar. But this requires a lot of work as the other fields in the TASKDIALOGCONFIG structure must match the properties that you have set for Delphi's TTaskDialog component.

Delphi creates a TASKDIALOGCONFIG structure as a local variable in the function TCustomTaskDialog.DoExecute in Dialogs.pas that is used to display the TaskDialog.