Solved

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

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

Accepted Solution

by:
Madshi earned 50 total points
Comment Utility
zulliger,

(1) The nasty variant:
var timerArr : array [1..77] of TTimer;
procedure TForm1.Create(Sender: TObject);
begin
  timerArr[1]:=timer1; timerArr[2]:=timer2; timerArr[3]:=...
end;

(2) A little bit better:
Create your timers at runtime, not at designtime.
var timerArr : array [1..77] of TTimer;
procedure TForm1.Create(Sender: TObject);
var i1 : integer;
begin
  for i1:=1 to 77 do begin
    timerArr[i1]:=TTimer.Create(Form1);
    with timerArr[i1] do begin
      enabled:=...; ...
    end;
  end;
end;

Regards, Madshi.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
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…

762 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

11 Experts available now in Live!

Get 1:1 Help Now