Solved

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

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

773 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