Solved

Component name thingy

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

867 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

12 Experts available now in Live!

Get 1:1 Help Now