Link to home
Start Free TrialLog in
Avatar of Prof_MAM
Prof_MAM

asked on

CounDown timer

i want to make Count down Timer Witch Begin From 01:00:00  hour for example and count down to 00:00:00 How to represent that in digital clock ?
ASKER CERTIFIED SOLUTION
Avatar of mokule
mokule
Flag of Poland image

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

  one label and one timer

  {----------------------------------------------------------}

unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Timer1: TTimer;
    Label1: TLabel;
    procedure FormCreate(Sender: TObject);
    procedure Timer1Timer(Sender: TObject);
  private
    { Private declarations }
    UpTime    : TDateTime;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
var
  tmp : TSystemTime;
begin
  with tmp do
    begin
      // the date is not important
      wYear          := 2004;
      wMonth         := 4;
      wDayOfWeek     := 3;
      wDay           := 22;
      // initialize the time
      wHour          := 1;
      wMinute        := 0;
      wSecond        := 1;
      wMilliseconds  := 0;
    end;
  UpTime := SystemTimeToDateTime(tmp);
  UpTime := Now + Uptime;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Label1.Caption := FormatDateTime('hh:nn:ss', UpTime - Now);
end;
For 200 extra points I can send you my own component what do exactly what you need. I use it ( in component ) to shut down the system after a specified time, but you can change this action to adapt for your needs.

Until then I can send a sample demo.
Avatar of Prof_MAM
Prof_MAM

ASKER

for moukle And Ivanov_G Your Solution Are excelent but I don't want to use Labels Ineed Somthing more beatiful (For Look And fell).
For  ginsonic I am really have null Points so I can't increas the points because Ihaven't

  You can use some LED component. Take a look here :

  http://www.torry.net/pages.php?id=120

  (this is in case you want to make it look like electronic clock)
I'm using images drawn by myself for this purpose.
They are corresponding with scoreboards I'm using.
Best draw it yourself, it's only ten digits :) and some background image.
Don't shout me for try :) I need points to have full access to this portal ( 3000 points/month ).

Give me your address to send the file.
for ginsonic
sorry for being late this is my email  
prof_mam1@hotmail.com
for  Ivanov_G : iam using delphi 7 and torry comonent work with d1 -d2 ...d5

   I installed Advanced Led v.1.0 on Delphi 7 without problems. I was unable to install in on D8, but on D7 it works fine.... Try it...
I installed the component successfully how to use it?

   Set the properties and handle each time tick - let's say 1000 ms - 1 seconds...
Read your mail.

   Sorry, my mistake. I gave you wrong component to install. Try TDynaLED v.1.0.
   It behaves like clock and have caption property, so in my code above you have to change this :

  procedure TForm1.Timer1Timer(Sender: TObject);
  begin
    DynaLED1.Caption := FormatDateTime('hh:nn:ss', UpTime - Now);
  end;
there is missing file in your packge ginsonic DsgnIntf.Dcu
Isn't messing. I think that you use D6 or up.
DsgnIntf is now DesignIntf
For messing read missing . Ups!