Results 1 to 4 of 4

Thread: Why is this a type mismatch?

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

    Default Why is this a type mismatch?

    I am trying to use a TTimer.. but I'm getting a type mismatch for some reason. This example is ripped right off of @Daniel's Form tutorial.

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

    procedure OnTimeUp(Sender: TObject);
    begin
      Writeln('5 seconds have passed!');
    end;

    procedure InitialiseForm;
    begin
      frmMain := TForm.Create(nil);
      frmMain.Show;
      begin
        timerUpdate := TTimer.Create(frmMain);
        timerUpdate.INTERVAL := 5000;
        timerUpdate.Enabled := True;
        timerUpdate := @OnTimeUp;
      end;
    end;

    begin
      ThreadSafeCall('InitialiseForm', Params);
      frmMain.Close;
      frmMain.Free;
    end.

    Type mismatch at this line:

    Simba Code:
    timerUpdate := @OnTimeUp;

  2. #2
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    .ontimer needs to be added
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

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

    Default

    Quote Originally Posted by Awkwardsaw View Post
    .ontimer needs to be added
    Simba Code:
    var
      frmMain: TForm;
      Params: TVariantArray;
      timerUpdate:TTimer;

    procedure OnTimeUp(Sender: TObject);
    begin
      Writeln('5 seconds have passed!');
    end;

    procedure InitialiseForm;
    begin
      frmMain := TForm.Create(nil);
      frmMain.Show;
      begin
        timerUpdate := TTimer.Create(frmMain);
        timerUpdate.INTERVAL := 5000;
        timerUpdate.Enabled := True;
        timerUpdate.ONTIMER := @OnTimeUp;
      end;
    end;

    begin
      ThreadSafeCall('InitialiseForm', Params);
      frmMain.Close;
      frmMain.Free;
    end.

    that just crashes simba lol

  4. #4
    Join Date
    Feb 2012
    Location
    Wonderland
    Posts
    1,988
    Mentioned
    41 Post(s)
    Quoted
    272 Post(s)

    Default

    I believe what you are questioning can be found here:
    http://villavu.com/forum/showthread.php?t=3664
    (Freddy's Forms TTimer tutorial)

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
  •