On 30 August 2010 11:30, Frank Church <vfcli...@gmail.com> wrote: > Is there a subroutine that can convert an enum value to a strings, so that > I can do something like ShowMessage(EnumToStr(enumValue))? > > -- > program testnums; //{$APPTYPE CONSOLE}
uses Classes, SysUtils; type stType = (stLite := -100, stDb, stBothLite, stBothDb); //settings location Type var d : stType; s : string; i : integer; begin d:= stLite; writestr(s,d); writeln(s + ' ' + IntToStr(Integer(d))); d:= stDb; writestr(s,d); writeln(s + ' ' + IntToStr(Integer(d))); d:= stBothLite; writestr(s,d); writeln(s + ' ' + IntToStr(Integer(d))); d:= stBothDB; writestr(s,d); writeln(s + ' ' + IntToStr(Integer(d))); readln; end. This is the code I created, as enums are stored as integers, or QWORDs, what is the default way of displaying the integer value of an enum. Frank Church > > ======================= > http://devblog.brahmancreations.com > -- Frank Church ======================= http://devblog.brahmancreations.com
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal