blob: 9bd0b93c3798f14f7bfa315a26496bfe51715534 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
program example9;
{ This program demonstrates the GetEnumName, GetEnumValue functions }
{$mode objfpc}
uses rttiobj,typinfo;
Var
O : TMyTestObject;
TI : PTypeInfo;
begin
O:=TMyTestObject.Create;
TI:=GetPropInfo(O,'MyEnumField')^.PropType;
Writeln('GetEnumName : ',GetEnumName(TI,Ord(O.MyEnumField)));
Writeln('GetEnumValue(mefirst) : ',GetEnumName(TI,GetEnumValue(TI,'mefirst')));
O.Free;
end.
|