Solved

Label changing part 2

Posted on 1998-03-14
5
154 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

911 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

19 Experts available now in Live!

Get 1:1 Help Now