Link to home
Start Free TrialLog in
Avatar of Sendo
Sendo

asked on

Stopwatch

How do you create a simple stopwatch on a form (00-00-00) type...stop,go reset???
ASKER CERTIFIED SOLUTION
Avatar of isasori
isasori

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Just a little comment :
Is there a possibility to make the stopwatch show 1/100 sec ?
Avatar of craig_capel
craig_capel

yes i can do it
brb with answer, just creating it...
unit timer1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Edit1: TEdit;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
    loopfinish: boolean;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var
  t,num: real;
begin
    t:=gettickcount;
    loopfinish:=false;
    repeat
      num:=(gettickcount-t)/1000;
      edit1.text:=floattostr(num);
      application.processmessages;

    until loopfinish=true;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
    loopfinish:=true;
end;

end.

stick a start and a stop button on the form, then put an edit box on, and this is what i think your after....
My example of a stopwatch shows hours, minute, second in a format hh-mm-ss.
Timer.Interval property is equal 1000.

To show 1/100 seconds it is necessary to add an item "-zz" in Label and to count them similarly to count of hours, Interval property = 10.

( For 1/10 it's necessary to add only
"-z" and to count up to 9, Interval property = 100).
yes but thats more of a fast clock than a real stopwatch....
Avatar of Sendo

ASKER

How do I pass stopwatch info to another Form (F2)?
Thanx!
easily done.....  http://members.xoom.com/craig_c/

oh you want to know how? but you ignored my comment