[Overview][Constants][Types][Classes][Procedures and functions] |
Return the value of a string property.
Source position: line 0
function GetStrProp( |
Instance: TObject; |
PropInfo: PPropInfo |
):Ansistring; |
Instance: TObject; |
const PropName: String |
):String; |
GetStrPropreturns the value of the string property described by PropInfoor with name PropNamefor object Instance.
No checking is done whether Instanceis non-nil, or whether PropInfodescribes a valid string property of Instance. Specifying an invalid property name in PropNamewill result in an EPropertyErrorexception.
|
Set value of a string property |
|
|
Set a widestring property |
|
|
Get the value of an ordinal property |
|
|
Return value of floating point property |
|
|
return value of an Int64 property |
|
|
Return value of a method property |
program example3; { This program demonstrates the GetStrProp function } {$mode objfpc} uses rttiobj,typinfo; Var O : TMyTestObject; PI : PPropInfo; begin O:=TMyTestObject.Create; PI:=GetPropInfo(O,'AnsiStringField'); Writeln('String property : '); Writeln('Value : ',O.AnsiStringField); Writeln('Get (name) : ',GetStrProp(O,'AnsiStringField')); Writeln('Get (propinfo) : ',GetStrProp(O,PI)); SetStrProp(O,'AnsiStringField','First'); Writeln('Set (name,''First'') : ',O.AnsiStringField); SetStrProp(O,PI,'Second'); Writeln('Set (propinfo,''Second'') : ',O.AnsiStringField); O.Free; end.