Solved

Component name thingy

Posted on 2003-11-11
2
198 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
[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
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

Industry Leaders: 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

Suggested Solutions

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

752 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