| 方法 | 描述 |
|---|---|
| GetPropInfo, FindPropInfo | 获得一个属性的数据结构 |
| SetPropValue | 按属性名称设置值 |
| SetXXXProp | 设置数据类型是 XXX 的属性的值 |
| GetPropList | 获得属性列表的指针 |
| 类 | 描述 |
|---|---|
| TPropInfo | 代表一个属性 |
| TTypeData | 类型数据( |
| function GetPropInfo(Instance: TObject; const PropName:
string; AKinds: TTypeKinds): PPropInfo; function GetPropInfo(AClass: TClass; const PropName: string; AKinds: TTypeKinds): PPropInfo; function FindPropInfo(AClass: TClass; const PropName: string): PPropInfo; function
FindPropInfo(Instance: TObject; const PropName: string): PPropInfo; |
| procedure SetPropValue(Instance: TObject; const PropName: string; const Value: Variant) |
| function GetTypeData(TypeInfo: PTypeInfo): PTypeData; |
| function GetPropList(TypeInfo: PTypeInfo; TypeKinds: TTypeKinds; PropList: PPropList; SortList: Boolean): Integer; |
指示过程/函数,尾随所定义的过程或函数。
| 关键词 | 意义 |
|---|---|
| procedure GetClassProperties(AClass: TClass; AStrings: TStrings); var PropCount, I: SmallInt; PropList: PPropList; PropStr: string; begin PropCount := GetTypeData(AClass.ClassInfo).PropCount; GetPropList(AClass.ClassInfo, PropList); for I := 0 to PropCount - 1 do begin case PropList[I]^.PropType^.Kind of tkClass : PropStr := '[Class] '; tkMethod : PropStr := '[Method]'; tkSet : PropStr := '[Set] '; tkEnumeration: PropStr := '[Enum] '; else PropStr := '[Field] '; end; PropStr := PropStr + PropList[I]^.Name; PropStr := PropStr + ': ' + PropList[I]^.PropType^.Name; AStrings.Add(PropStr); end; FreeMem(PropList); end; |