Solved

Label changing part 2

Posted on 1998-03-14
5
165 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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 is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

734 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