Max I just noticed IsPublishedProp in TypeInfo
function IsPublishedProp(AClass: TClass; const PropName: string): Boolean; begin Result := GetPropInfo(AClass, PropName) <> nil; end; ----- Original Message ----- From: "Max Nilson" <[EMAIL PROTECTED]> To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]> Sent: Thursday, September 26, 2002 9:23 AM Subject: RE: [DUG]: RTTI > Rohit Gupta asks: > > > I cant seem to find it right now....but how do I find out if a > > control has a > > particular published property and how do I access it ? > > The other methods are somewhat lengthy, so here's the code we use for this > to determine if a property is available on an object: > > function PropertyExists(Instance: TObject; const PropName: String): Boolean; > begin > Result := GetPropInfo(Instance.ClassInfo, PropName) <> nil; > end; > > once you know the peoperty exists and are sure as to the type you can do fun > stuff like this: > > PropInfo := GetPropInfo(Instance.ClassInfo, PropName); > if PropInfo.PropType^.Kind = tkString then > begin > // Read its value by doing > Value := GetStrProp(Instance, PropInfo); > > // Set its value by doing > SetStrProp(Instance, PropInfo, 'New Value!'); > end > > Have a look int TypInfo for all the available routines that ley you muck > about with the type data, and allow reading and writing of properties. Its > all rather fun once actually 8-) > > Cheers, Max. > > > -------------------------------------------------------------------------- - > New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] > Website: http://www.delphi.org.nz > To UnSub, send email to: [EMAIL PROTECTED] > with body of "unsubscribe delphi" > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ > --------------------------------------------------------------------------- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/