Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit Unit1;
- {$mode objfpc}{$H+}
- interface
- uses
- Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, Buttons,
- ExtCtrls;
- type
- { TForm1 }
- TForm1 = class(TForm)
- Cronometrar: TBitBtn;
- Parar: TBitBtn;
- Edit1: TEdit;
- Timer1: TTimer;
- procedure CronometrarClick(Sender: TObject);
- procedure PararClick(Sender: TObject);
- procedure Timer1Timer(Sender: TObject);
- private
- public
- end;
- var
- Form1: TForm1;
- HoraInicial:TDateTime;
- implementation
- {$R *.lfm}
- { TForm1 }
- procedure TForm1.CronometrarClick(Sender: TObject);
- begin
- HoraInicial := Now;
- Timer1.Enabled := True;
- end;
- procedure TForm1.PararClick(Sender: TObject);
- begin
- HoraInicial := Now;
- Timer1.Enabled := False;
- end;
- procedure TForm1.Timer1Timer(Sender: TObject);
- begin
- Edit1.Text := FormatDateTime('hh:mm:ss',Now-HoraInicial);
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement