Thanks for the help - Problem resolved. John Barrat
-----Original Message----- From: Delphi [mailto:[email protected]] On Behalf Of Stephen Posey Sent: 23 April 2014 17:50 To: Moderated List for the Discussion of Delphi Programming excluding Database-related topics; 'Moderated List for the Discussion of Delphi Programming excluding Database-related topics' Subject: Re: Quetion about using the Delphi RTTI TPen is not a record, it's another class (with its own properties and RTTI). The Control.Pen property is actually reference to an internally instantiated TPen object. So, to do what you're describing, you need to access the RTTI for the TPen instance within the control. Try something like this: PropValue := GetPropValue(Control.Pen, "Width"); HTH Stephen Posey [email protected] -----Original Message----- >From: John Barrat <[email protected]> >Sent: Apr 22, 2014 6:28 AM >To: 'Moderated List for the Discussion of Delphi Programming excluding >Database-related topics' <[email protected]> >Subject: Quetion about using the Delphi RTTI > >I am using GetPropValue get the properties of a control. > >e.g. PropValue := GetPropValue(Control, PropertyName); > >This works fine for simple properties such as color, Caption, width etc. >However, it does not work if the property is a record. > >e.g TPen Has 2 elements, Width and Color. > >If I just use Width it returns the control's width. If I use Pen.Width >it errors with "Property Pen.Width does not exist" > >Similarly, if I use Color it returns the control's color, if I use >Pen.Color I get the same error message. > >What do I need to do to access these properties? > >The control in question is a TShape but I am guessing this would apply >to any control using a TPen. > > > >John Barrat > _______________________________________________ Delphi mailing list [email protected] http://lists.elists.org/cgi-bin/mailman/listinfo/delphi _______________________________________________ Delphi mailing list [email protected] http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
