Get the value of an ordinal property.
Source position: typinfo.pp line 1227
function GetOrdProp( |
Instance: TObject; |
PropInfo: PPropInfo |
):Int64; |
Instance: TObject; |
const PropName: string |
):Int64; |
GetOrdProp returns the value of the ordinal property described by PropInfo or with name PropName for the object Instance. The value is returned as a longint, which should be typecast to the needed type.
Ordinal properties that can be retrieved include:
No checking is done whether Instance is non-nil, or whether PropInfo describes a valid ordinal property of Instance Specifying an invalid property name in PropName will result in an EPropertyError exception.
|
Set value of an ordinal property. |
|
|
Return the value of a string property. |
|
|
Return value of floating point property. |
|
|
return value of an Int64 property. |
|
|
Return value of a method property. |
|
|
Return the value of a set property. |
|
|
Return value of an object-type property. |
|
|
Return the value of an enumeration type property. |
program example1; { This program demonstrates the GetOrdProp function } {$mode objfpc} uses rttiobj,typinfo; Var O : TMyTestObject; PI : PPropInfo; begin O:=TMyTestObject.Create; Writeln('Boolean property : '); Writeln('Value : ',O.BooleanField); Writeln('Ord(Value) : ',Ord(O.BooleanField)); Writeln('Get (name) : ',GetOrdProp(O,'BooleanField')); PI:=GetPropInfo(O,'BooleanField'); Writeln('Get (propinfo) : ',GetOrdProp(O,PI)); SetOrdProp(O,'BooleanField',Ord(False)); Writeln('Set (name,false) : ',O.BooleanField); SetOrdProp(O,PI,Ord(True)); Writeln('Set (propinfo,true) : ',O.BooleanField); O.Free; end.