Remember, if you don't derive from TPersistent or a derivative thereof, include the compiler directive {$M+} (or {TYPEINFO ON}) for the class or classes in question or no RTTI data will be available.
-Andreas -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Rohit Gupta Sent: Thursday, 26 September 2002 09:51 To: Multiple recipients of list delphi Subject: RE: [DUG]: RTTI Thanks Guys To: Multiple recipients of list delphi <[EMAIL PROTECTED]> Send reply to: [EMAIL PROTECTED] From: "Max Nilson" <[EMAIL PROTECTED]> Subject: RE: [DUG]: RTTI Date sent: Thu, 26 Sep 2002 09:23:06 +1200 > 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/ > Regards Rohit ====================================================== ================ CFL - Computer Fanatics Ltd. 21 Barry's Point Road, AKL, New Zealand PH (649) 489-2280 FX (649) 489-2290 email [EMAIL PROTECTED] or [EMAIL PROTECTED] ====================================================== ================ --------------------------------------------------------------------------- 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/