RTTI - determining property information (Views: 29)
Problem/Question/Abstract: A RTTI question - it is possible to determine if a certain property is Read-Only, Write-Only or stored? Answer: The following code checks whether a property can be written to, read or whether it is stored. function IsWriteProp(Info: PPropInfo): Boolean; begin Result := Assigned(Info) and (Info^.SetProc <> nil) end; function IsReadProp: Boolean; begin Result := Assigned(Info) and (Info^.GetProc <> nil) end; function IsStoredProp: Boolean; begin Result := Assigned(Info) and TYPINFO.IsStoredProp(FObj, Info) end; |