Solved

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

Posted on 1998-08-31
1
215 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

708 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