Solved

Label changing part 2

Posted on 1998-03-14
5
152 Views
Last Modified: 2010-04-06
Will you give me an EXAMPLE please,  on displaying a new text on a label  every 24 hrs with the aid of a TTimer.
In particular, give an example of a written  OnTImer eventhandler that updates the label caption every 24hrs.

p.s.  Isn't this really easier than 50 points?
0
Comment
Question by:jjhj
  • 2
  • 2
5 Comments
 
LVL 2

Accepted Solution

by:
rene100 earned 50 total points
ID: 1360503
try this (I haven't tested this for 24 hours, just for 1 minute)



unit Unit1;

interface

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

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

var
  Form1: TForm1;
  PassedTime: Cardinal;
implementation

{$R *.DFM}

procedure TForm1.Timer1Timer(Sender: TObject);
begin
inc(PassedTime); //every minute
if PassedTime=1440 then //after 24 hours (60 * 24);
   begin
   MessageDlg('24 hours passed',mtInformation,[mbok],0);
   label1.caption:='24 hours passed';
   //Here, you can restart this with
   //TimePassed:=0;
end;

procedure TForm1.btStartClick(Sender: TObject);
begin
timer1.interval:=60000; //Sets interval of timer1 to 60000 ms
                        //=1 minute
end;

end.
0
 
LVL 1

Expert Comment

by:pjdb
ID: 1360504
If it is in a 32bits program, i think you can give a timer interval of 86400000 (24*60*60*1000) and have your timer working once a day. However, in 16 bits (delphi 1) it will give an overflow.

JDB
0
 

Author Comment

by:jjhj
ID: 1360505
rene 100

you did a great job!  
if i had extra points to spare i would give em,   however...

thanks bunches, loads , tons, greatly,immensly,weightily,
countlessly,,hugely,                 and frankly    alot.

jjhj
0
 

Author Comment

by:jjhj
ID: 1360506
rene 100

you did a great job!  
if i had extra points to spare i would give em,   however...

thanks bunches, loads , tons, greatly,immensly,weightily,
countlessly,,hugely,                 and frankly    alot.

jjhj
0
 
LVL 2

Expert Comment

by:rene100
ID: 1360507
thanks for the nice comment!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This video discusses moving either the default database or any database to a new volume.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now