Solved

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

Posted on 1998-08-31
1
198 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
ID: 1338302
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

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…
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…
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…

809 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