Solved

setting enumerated types by integer values?

Posted on 2001-08-21
5
135 Views
Last Modified: 2010-04-06
Hiya, just a little one.  Is there anyway to set an enumerated type just by setting its ordinal value?  E.g. for:

type TEnumeratedType = (etype1,etype2,etype3);

where:

var
Enum :TEnumeratedType;

I want to set Enum:=etype1 but only by using its ordinal value of 0. ie I want to be able to effectively set Ord(Enum)=0, if you see what I mean!  Is there anyway to do this (*without* writing a conversion function that converts any given integer to the appropriate TEnumeratedType constant)?  Many thanks, P.
0
Comment
Question by:Pandora
  • 3
5 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 50 total points
ID: 6409819
? maybe

enum := TEnumeratedType(0);
0
 
LVL 17

Expert Comment

by:geobul
ID: 6409973
Yes, exactly. Hi meikl, you are fast :-)

Regards, Geo
0
 
LVL 1

Author Comment

by:Pandora
ID: 6410007
aha! yes brill, thank you once again Meikl!! P.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6410011
hi geo,

i'm not really fast, i'm sometimes a bit lucky :-))
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6410033
oops,

thanks pandora,
glad to helped you :-))

meikl ;-)
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question