Results 1 to 10 of 12

Thread: How to delay without polling?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    can you provide a simple example, without classes (plain pascal)

  2. #2
    I hope this can be of help or inspiration.

    I use the Lazarus flavor of pascal:
    With one form with just one timer and one label (for showing the time) the whole no class quick example looks like this:

    unit Unit1;

    {$mode objfpc}{$H+}

    interface

    uses
    Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls;

    type

    { TForm1 }

    TForm1 = class(TForm)
    Label1: TLabel;
    Timer1: TTimer;
    procedure FormCreate(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
    private

    public

    end;

    var
    Form1: TForm1;
    iSeconds: integer;

    implementation

    {$R *.lfm}


    { TForm1 }

    procedure TForm1.Timer1Timer(Sender: TObject);
    begin
    iSeconds := iSeconds + 1;
    label1.Caption := IntToStr(iSeconds) + ' seconds counted.';
    end;

    procedure TForm1.FormCreate(Sender: TObject);
    begin
    iSeconds := 0;
    end;

    end.
    Last edited by Jonax; 11-07-2022 at 08:14 PM. Reason: comment

Tags for this Thread

Bookmarks

Posting Permissions

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