~ubuntu-branches/ubuntu/dapper/fpc/dapper

« back to all changes in this revision

Viewing changes to docs/typinfex/ex4.pp

  • Committer: Bazaar Package Importer
  • Author(s): Carlos Laviola
  • Date: 2004-08-12 16:29:37 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040812162937-moo8ulvysp1ln771
Tags: 1.9.4-5
fp-compiler: needs ld, adding dependency on binutils.  (Closes: #265265)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
program example4;
 
2
 
 
3
{ This program demonstrates the GetFloatProp function }
 
4
 
 
5
{$mode objfpc}
 
6
 
 
7
uses rttiobj,typinfo;
 
8
 
 
9
Var
 
10
  O : TMyTestObject;
 
11
  PI : PPropInfo;
 
12
  
 
13
begin
 
14
  O:=TMyTestObject.Create;
 
15
  Writeln('Real property : ');
 
16
  PI:=GetPropInfo(O,'RealField');
 
17
  Writeln('Value            : ',O.RealField);
 
18
  Writeln('Get (name)       : ',GetFloatProp(O,'RealField'));
 
19
  Writeln('Get (propinfo)   : ',GetFloatProp(O,PI)); 
 
20
  SetFloatProp(O,'RealField',system.Pi);
 
21
  Writeln('Set (name,pi)    : ',O.RealField);
 
22
  SetFloatProp(O,PI,exp(1));
 
23
  Writeln('Set (propinfo,e) : ',O.RealField);
 
24
  Writeln('Extended property : ');
 
25
  PI:=GetPropInfo(O,'ExtendedField');
 
26
  Writeln('Value            : ',O.ExtendedField);
 
27
  Writeln('Get (name)       : ',GetFloatProp(O,'ExtendedField'));
 
28
  Writeln('Get (propinfo)   : ',GetFloatProp(O,PI)); 
 
29
  SetFloatProp(O,'ExtendedField',system.Pi);
 
30
  Writeln('Set (name,pi)    : ',O.ExtendedField);
 
31
  SetFloatProp(O,PI,exp(1));
 
32
  Writeln('Set (propinfo,e) : ',O.ExtendedField);
 
33
  O.Free;
 
34
end.
 
 
b'\\ No newline at end of file'