?
Solved

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

Posted on 1998-08-31
1
Medium Priority
?
225 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 200 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

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

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…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Loops Section Overview
Suggested Courses

862 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