Solved

Component name thingy

Posted on 2003-11-11
2
196 Views
Last Modified: 2010-04-05
Hi there,

I have an App that uses an ini file, and this app has approximately 200 small panels on the main form. This is to monitor NT Services over the network, and it is working well. All I would like to change now is the fact that if I read from the ini file, I get back a colour for a service - Service122 for instance and then have to say :  if ..... then pnlServ122.Color := clGreen, etc.
I have tried to concatinate the "pnlServ" and "122" but then Delphi does not see it as a component. Is there another easier way to read a component name from an ini file and use it ?

Yo, I really hope this question make sense ?!

Thanks !!

Pieter
0
Comment
Question by:PieterJ
  • 2
2 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 250 total points
ID: 9728698
var
  p : TPanel;
begin
  p := findcomponent('pnlServ122');
  if (assigned(p))  and (p is TPanel) then
    p.color := clgreen;
end;

meikl ;-)
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 9728702
maybe also this way

var
  p : TComponent;
begin
  p := findcomponent('pnlServ122');
  if (assigned(p))  and (p is TPanel) then
    TPanel(p).color := clgreen;
end;

meikl ;-)

0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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

820 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