I use the dialog to confirm user actions:
TDialogService.MessageDialog('Question?', System.UITypes.TMsgDlgType.mtInformation,
[System.UITypes.TMsgDlgBtn.mbYes, System.UITypes.TMsgDlgBtn.mbNo],
System.UITypes.TMsgDlgBtn.mbNo, 0,
// Use an anonymous method to make sure the acknowledgment appears as expected.
procedure(const AResult: TModalResult)
begin
if Result = mrNo then
Exit
else begin
...
ProgressBar1.Visible := True;
ProgressBar1.Value := i;
Application.ProcessMessages;
...
But since MessageDialog is executed in a separate thread, nothing happens on the screen. How do I make the ProgressBar display and change its values?
I tried to turn on the timer before calling the dialog, changed the value of an external variable inside the dialog, and processed this value in the timer, but nothing happened
MessageDialogreturns to your code that you don't subsequently block the UI thread message loop so it can process the dialog and call your anonymous procedure when the dialog is closed.