Solved

use component like a array (timer1, timer2...)

Posted on 1998-08-31
1
216 Views
Last Modified: 2010-04-04
I have more timers (timer1 timer2 timer3...) how can I use them with a counter (int c;).
for Example something like that:
timer[c].enabled := true

Thank you.
0
Comment
Question by:zulliger
1 Comment
 
LVL 10

Accepted Solution

by:
Lischke earned 50 total points
ID: 1338303
That's easy :-) Use a TList to hold your timers. Somwhere in your code you have to create the timers, say:

type MyControl= class...
     private
       FTimerList : TList;
     end;

procedure OnDoSomething...;

var ATimer : TTimer;

begin
  ATimer:=TTimer.Create;
  // setup ATimer: ATimer.Interval:=100; etc.
  FTimerList.Add(ATimer);
end;

The access is easy as well:

for I:=0 to FTimerList.Count-1 do
  TTimer(FTimerList[I]).enabled:=True;

Ciao, Mike
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

Suggested Solutions

Title # Comments Views Activity
IExtractImage Delphi 14 202
Delphi OLE Error 8 95
Find and Replace Stream with 0s 8 57
Dynamically Created Query 3 50
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

910 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