0

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.

Mike at Bookup
  • 1,211
  • 14
  • 32

2 Answers2

4

The timer event handler execute in the context of the thread having created it. Usually it is the main thread but you can create a timer within any thread.

fpiette
  • 11,983
  • 1
  • 24
  • 46
1

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

Z .
  • 12,657
  • 1
  • 31
  • 56