Board index » delphi » Property access by string

Property access by string

I don't know if this has been asked before or not. I am not a
professional programmer but am on a tight schedule (who isn't).

My problem is the following. I want to access a property from a string
that I have figured out before. The following example doesn't make
sense, but it is only there to show the principle.

procedure foo;
var s,t : string;
begin
   s:='text';
   t:=Tedit1.s;
end;

I want to get the contents of the text property of the Tedit1 component.
I can do it directly but I have a lot of properties to do and I want to
do it automatically after I have figured out the value of string s.
The code above unfortunately doesn't work and I don't  know how to do
this. Does anyone have any ideas?

Best regards,

Kim Beumer

 

Re:Property access by string


Quote
"Kim Beumer" <kbeu...@airmail.net> wrote in message

news:F2A7A360B801F122.13535B4F5A165BF7.ADAFBE6D48939639@lp.airnews.net...

Quote
> I don't know if this has been asked before or not. I am not a
> professional programmer but am on a tight schedule (who isn't).
> My problem is the following. I want to access a property from a string
> that I have figured out before. The following example doesn't make
> sense, but it is only there to show the principle.

You can do it for published properties, take a look at the TypInfo.pas unit.

Re:Property access by string


IT WORKS!!

thanx

Quote
Bruce Roberts wrote:
> "Kim Beumer" <kbeu...@airmail.net> wrote in message
> news:F2A7A360B801F122.13535B4F5A165BF7.ADAFBE6D48939639@lp.airnews.net...
> > I don't know if this has been asked before or not. I am not a
> > professional programmer but am on a tight schedule (who isn't).

> > My problem is the following. I want to access a property from a string
> > that I have figured out before. The following example doesn't make
> > sense, but it is only there to show the principle.

> You can do it for published properties, take a look at the TypInfo.pas unit.

Other Threads