[fpc-pascal]RTTI

Jean-Pierre PLANAS Sybaris at club-internet.fr
Mon Jan 21 10:30:36 CET 2002


Hello

Here a piece of delphi code i want to port to fpc.

     uses TypInfo;

     type 
TJour=(jrLundi,jrMardi,jrMercredi,jrJeudi,jrVendredi,jrSamedi,jrDimanche);

     procedure TForm1.btnClick(Sender: TObject);
     begin
     ShowMessage(IntToStr(GetEnumValue(TypeInfo(TJour),'jrMardi')));
     ShowMessage(GetEnumName(TypeInfo(TJour),1));
     end;

I saw that fpc have a typeInfo.pp unit with GetEnumValue and GetEnumName 
functions.
But i can use them like with delphi.

     Writeln(GetEnumValue(???(TJour),'jrMardi'));
     Writeln(GetEnumName(???(TJour),1));

What can replace ??? ?

Sybaris.





More information about the fpc-pascal mailing list