Results 1 to 4 of 4

Thread: TTimer not working

  1. #1
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default TTimer not working

    Simba Code:
    var
      frmMain: TForm;
      ThreadOne: TTimer;
      Params: TVariantArray;

    procedure OnTick(Sender: TObject);
    begin
      Writeln('progress report');
    end;

    procedure InitialiseTimer;
    begin
      ThreadOne := TTimer.Create(frmMain);
    end;

    procedure InitialiseForm;
    begin
      frmMain := TForm.Create(nil);
    end;

    begin
      ThreadSafeCall('InitialiseForm', Params);
      ThreadSafeCall('InitialiseTimer', Params);
      ThreadOne.OnTimer := @OnTick;
      ThreadOne.Interval := 900;
      ThreadOne.Enabled := True;

      repeat
        Writeln('Mainloop');
        Sleep(500);
      Until(IsKeyDown(VK_F3));

      ThreadOne.Enabled := False;
      ThreadOne.Free;
      frmMain.Close;
      frmMain.Free;
    end.

    The TTimer isn't working here, any ideas?

  2. #2
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    If your trying to use a script with it to hack "multithreading" it won't work.

    (Im sure ive told you multiple times lol)
    Last edited by Olly; 06-10-2013 at 08:51 PM.

  3. #3
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Quote Originally Posted by Ollybest View Post
    If your trying to use a script with it to hack "multithreading" it won't work.

    (Im sure ive told you multiple times lol)
    No.. uhh... i wanted to test out ttimer and i was wondering why it didn't work

  4. #4
    Join Date
    Sep 2012
    Location
    Here.
    Posts
    2,007
    Mentioned
    88 Post(s)
    Quoted
    1014 Post(s)

    Default

    I told you this wasn't working too. You can solve your problem in so many other ways, you don't need a ttimer to do real-time proggies.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •