help files
Z505 | PasWiki | FUQ | Search | Main Docs | API Guide



[Overview][Constants][Types][Classes][Procedures and functions] Reference for unit 'typinfo' (#rtl)

GetStrProp

Return the value of a string property.

Declaration

Source position: line 0

function GetStrProp(

  Instance: TObject;

  PropInfo: PPropInfo

):Ansistring;

function GetStrProp(

  Instance: TObject;

  const PropName: String

):String;

Description

GetStrProp returns the value of the string property described by PropInfo or with name PropName for object Instance.

Errors

No checking is done whether Instance is non-nil, or whether PropInfo describes a valid string property of Instance. Specifying an invalid property name in PropName will result in an EPropertyError exception.

See also

SetStrProp

  

Set value of a string property

SetWideStrProp

  

Set a widestring property

GetOrdProp

  

Get the value of an ordinal property

GetFloatProp

  

Return value of floating point property

GetInt64Prop

  

return value of an Int64 property

GetMethodProp

  

Return value of a method property

Example

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.

Notes

 No notes exist for this page yet. 





lufdoc, Powtils, fpc, freepascal, delphi, kylix, c/c++, mysql, cgi web framework docs, Z505