<br><br><div class="gmail_quote">On 30 August 2010 11:30, Frank Church <span dir="ltr"><<a href="mailto:vfclists@gmail.com">vfclists@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Is there a subroutine that can convert an enum value to a strings, so that I can do something like ShowMessage(EnumToStr(enumValue))?<br clear="all"><font color="#888888"><br>-- <br></font></blockquote>program testnums;<br>
//{$APPTYPE CONSOLE}<br><br><br>uses<br> Classes, SysUtils; <br>type<br> stType = (stLite := -100, stDb, stBothLite, stBothDb); //settings location Type<br><br>var<br> d : stType;<br> s : string;<br> i : integer;<br>begin<br>
<br> d:= stLite;<br> writestr(s,d);<br> writeln(s + ' ' + IntToStr(Integer(d)));<br><br> d:= stDb;<br> writestr(s,d);<br> writeln(s + ' ' + IntToStr(Integer(d)));<br><br> d:= stBothLite;<br> writestr(s,d);<br>
writeln(s + ' ' + IntToStr(Integer(d)));<br><br> d:= stBothDB;<br> writestr(s,d);<br> writeln(s + ' ' + IntToStr(Integer(d)));<br> <br> readln;<br>end.<br><br>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.<br>
<br><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><font color="#888888">Frank Church<br><br>=======================<br><a href="http://devblog.brahmancreations.com" target="_blank">http://devblog.brahmancreations.com</a><br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Frank Church<br><br>=======================<br><a href="http://devblog.brahmancreations.com">http://devblog.brahmancreations.com</a><br>