troubleshooting Question

TTimer created by TThread

Avatar of Actia
Actia asked on
Delphi
9 Comments2 Solutions5825 ViewsLast Modified:
I've got such a Thread:


  TReadRespThread = class(TThread)
  private
    { Private declarations }
    Timer : TTimer;
    procedure NewTimer1Timer(Sender: TObject);
  protected
    procedure Execute; override;
  public
  end;


procedure TReadRespThread.Execute;
begin
  inherited;
  Timer := TTimer.Create(Application);
  Timer.Interval := 100;
  Timer.OnTimer := NewTimer1Timer;
  Timer.Enabled := True;
end;

procedure TReadRespThread.NewTimer1Timer(Sender: TObject);
begin
  //for some reason the program flow never comes here

end;

1. Why doesn't it work?
2. Is such a Timer running in a separate thread (not in the main thread)?

Jackie boy  :-)
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 9 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros