Include the unit TypInfo in your uses clause and then use the following:
To find the name of the enumerated value based on it's index in the
enumerated type use
GetEnumName(TypeInfo(MyEnumeratedType), index) // note that the
TypeInfo(MyEnumeratedType) is typecasting MyEnumeratedType to the
TypeInfo. Be sure to check TypeInfo out because it contains heaps of
information.
To find the number of items in an enumerated type, I am not sure but I
think you can use:
GetTypeData(TypeInfo(MyEnumeratedType)).MaxValue + 1
I'm pretty sure that MaxValue returns the highest index accessible in
the Enumerated Type
Hope this helps.
Phil.
[EMAIL PROTECTED]
From: "Jim Zheng" <[EMAIL PROTECTED]> AT tawa on 19/02/99 14:01 ZE12
To: Multiple recipients of list delphi <[EMAIL PROTECTED]> AT
tawa@kauripo@CCMAIL
cc: (bcc: Phillip Middlemiss/NZ Forest Research Institute/NZ)
Subject: [DUG]: about SET
Hi all,
Does anyone know how to get the number of element in a set and how to know
the value stored in first, second .. position of a set easily?
I know we can loop through the whole set, but is there any faster way?
Thanks,
Jim Zheng
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz