Search code examples
delphifiremonkeydelphi-10.4-sydney

Do timer events in Delphi happen in their own thread?


When a Delphi timer executes, is it not in the main thread?

procedure TMainForm.MyTimerTimer(Sender: TObject);
begin
      MyModalDialog.StatusText.BeginUpdate;
      MyModalDialog.StatusText.Text := 'timer fired...';
      MyModalDialog.StatusText.EndUpdate;
end;

I am wondering if crashes here are due to updating the GUI elements outside of the main thread.


Solution

  • The timer will execute on the main thread. No need to worry about using Synchronize().