Solved

Component name thingy

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

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…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 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

14 Experts available now in Live!

Get 1:1 Help Now