Solved

variables in object names

Posted on 1998-10-24
3
162 Views
Last Modified: 2010-04-06
I wanted to change 30 images at once.

TImage1, Timage2, Timage3......... etc...

A simple for next loop could do it if only I could substitute a variable in
the object name

e.g.     Timage(a)

The closest I've got is defining an array of Timages and then linking them
to the real images

e.g. Tempimage[1]:=Timage1
       Tempimage[2]:=Timage2

Tempimage[a]      works, but I know in my heart it's a cop out. I am a
newbie but I want to learn...

Is it possible... and how...???


Many thanks,
0
Comment
Question by:blobb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 4

Expert Comment

by:dwwang
ID: 1344206
Just use:

TImage[i]:=findcomponent('TImage'+inttostr(i));

or directly use something like: findcomponent(yourcomponentname);
0
 

Author Comment

by:blobb
ID: 1344207
Thanks dwwang

but I get an error message from the compiler..

incompatible types: Timage and Tcomponent
0
 
LVL 4

Accepted Solution

by:
dwwang earned 50 total points
ID: 1344208
Hi, this is just a general method, for special perpose, you can use:

TImage[i]:=findcomponent('TImage'+inttostr(i)) as TImage;
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…

734 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