Return the type of a property.
Source position: typinfo.pp line 1221
function PropType( |
Instance: TObject; |
const PropName: string |
):TTypeKind; |
AClass: TClass; |
const PropName: string |
):TTypeKind; |
Proptype returns the type of the property PropName for a class. The class to be examined can be specified in one of 2 ways:
No checks are done to ensure Instance or AClass are valid pointers. Specifying an invalid property name in PropName will result in an EPropertyError exception.
|
Check whether a published property exists. |
|
|
Check whether a property is stored. |
|
|
Check the type of a published property. |
program example17; { This program demonstrates the PropType function } {$mode objfpc} uses rttiobj,typinfo; Var O : TMyTestObject; begin O:=TMyTestObject.Create; Writeln('Property tests : '); Write('PropType(O,BooleanField) : '); Writeln(TypeNames[PropType(O,'BooleanField')]); Write('PropType(Class,BooleanField) : '); Writeln(TypeNames[PropType(O.ClassType,'BooleanField')]); Write('PropType(O,ByteField) : '); Writeln(TypeNames[PropType(O,'ByteField')]); Write('PropType(Class,ByteField) : '); Writeln(TypeNames[PropType(O.ClassType,'ByteField')]); O.Free; end.